diff options
Diffstat (limited to 'Source/kwsys/Glob.cxx')
-rw-r--r-- | Source/kwsys/Glob.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index b33b926..513eb64 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -259,26 +259,23 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, } bool isDir = kwsys::SystemTools::FileIsDirectory(realname.c_str()); + bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str()); - if ( !isDir ) + if ( isDir && (!isSymLink || this->RecurseThroughSymlinks) ) { - if ( (this->Internals->Expressions.size() > 0) && - this->Internals->Expressions[ - this->Internals->Expressions.size()-1].find(fname.c_str()) ) + if (isSymLink) { - this->AddFile(this->Internals->Files, realname.c_str()); + ++this->FollowedSymlinkCount; } + this->RecurseDirectory(start+1, realname); } else { - bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str()); - if (!isSymLink || this->RecurseThroughSymlinks) + if ( (this->Internals->Expressions.size() > 0) && + this->Internals->Expressions[ + this->Internals->Expressions.size()-1].find(fname.c_str()) ) { - if (isSymLink) - { - ++this->FollowedSymlinkCount; - } - this->RecurseDirectory(start+1, realname); + this->AddFile(this->Internals->Files, realname.c_str()); } } } |