summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/kwsys/Glob.cxx10
-rw-r--r--Source/kwsys/Glob.hxx.in8
3 files changed, 19 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index cae9220..e1b70ec 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -685,6 +685,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmsys::Glob gl;
gl.RecurseOn();
+ gl.RecurseThroughSymlinksOff();
std::string daGlob = cont->BinaryDir + "/*.da";
gl.FindFiles(daGlob);
std::vector<std::string> files = gl.GetFiles();
@@ -1054,6 +1055,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
{
cmsys::Glob gl;
gl.RecurseOn();
+ gl.RecurseThroughSymlinksOff();
std::string daGlob = cont->BinaryDir + "/*.cover";
gl.FindFiles(daGlob);
std::vector<std::string> files = gl.GetFiles();
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 6858689..80fdf29 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -63,6 +63,10 @@ Glob::Glob()
this->Internals = new GlobInternals;
this->Recurse = false;
this->Relative = "";
+
+ this->RecurseThroughSymlinks = true;
+ // RecurseThroughSymlinks is true by default for backwards compatibility,
+ // not because it's a good idea...
}
//----------------------------------------------------------------------------
@@ -262,7 +266,11 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
}
if ( kwsys::SystemTools::FileIsDirectory(realname.c_str()) )
{
- this->RecurseDirectory(start+1, realname, dir_only);
+ if (!kwsys::SystemTools::FileIsSymlink(realname.c_str()) ||
+ this->RecurseThroughSymlinks)
+ {
+ this->RecurseDirectory(start+1, realname, dir_only);
+ }
}
}
}
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index 7e2fb96..a66dd6f 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -57,6 +57,13 @@ public:
void SetRecurse(bool i) { this->Recurse = i; }
bool GetRecurse() { return this->Recurse; }
+ //! Set recurse through symlinks to true if recursion should traverse the
+ // linked-to directories
+ void RecurseThroughSymlinksOn() { this->SetRecurseThroughSymlinks(true); }
+ void RecurseThroughSymlinksOff() { this->SetRecurseThroughSymlinks(false); }
+ void SetRecurseThroughSymlinks(bool i) { this->RecurseThroughSymlinks = i; }
+ bool GetRecurseThroughSymlinks() { return this->RecurseThroughSymlinks; }
+
//! Set relative to true to only show relative path to files.
void SetRelative(const char* dir);
const char* GetRelative();
@@ -90,6 +97,7 @@ protected:
GlobInternals* Internals;
bool Recurse;
kwsys_stl::string Relative;
+ bool RecurseThroughSymlinks;
private:
Glob(const Glob&); // Not implemented.