diff options
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/Glob.cxx | 9 | ||||
-rw-r--r-- | Source/kwsys/Glob.hxx.in | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 80fdf29..f5dc512 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -67,6 +67,7 @@ Glob::Glob() this->RecurseThroughSymlinks = true; // RecurseThroughSymlinks is true by default for backwards compatibility, // not because it's a good idea... + this->FollowedSymlinkCount = 0; } //---------------------------------------------------------------------------- @@ -266,9 +267,13 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start, } if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) ) { - if (!kwsys::SystemTools::FileIsSymlink(realname.c_str()) || - this->RecurseThroughSymlinks) + bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname.c_str()); + if (!isSymLink || this->RecurseThroughSymlinks) { + if (isSymLink) + { + ++this->FollowedSymlinkCount; + } this->RecurseDirectory(start+1, realname, dir_only); } } diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in index a66dd6f..fb4eac6 100644 --- a/Source/kwsys/Glob.hxx.in +++ b/Source/kwsys/Glob.hxx.in @@ -64,6 +64,9 @@ public: void SetRecurseThroughSymlinks(bool i) { this->RecurseThroughSymlinks = i; } bool GetRecurseThroughSymlinks() { return this->RecurseThroughSymlinks; } + //! Get the number of symlinks followed through recursion + unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; } + //! Set relative to true to only show relative path to files. void SetRelative(const char* dir); const char* GetRelative(); @@ -98,6 +101,7 @@ protected: bool Recurse; kwsys_stl::string Relative; bool RecurseThroughSymlinks; + unsigned int FollowedSymlinkCount; private: Glob(const Glob&); // Not implemented. |