summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/Glob.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-09-11 18:34:04 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-09-11 18:34:04 (GMT)
commitbd1935dcd12d23a23878dc727545743fb078c7cb (patch)
treef25e552c73dc9ea3c31ff186829f5bdd905c1324 /Source/kwsys/Glob.cxx
parent0e5319f21dc6a6079a8af82e40ca3e9da563b6de (diff)
downloadCMake-bd1935dcd12d23a23878dc727545743fb078c7cb.zip
CMake-bd1935dcd12d23a23878dc727545743fb078c7cb.tar.gz
CMake-bd1935dcd12d23a23878dc727545743fb078c7cb.tar.bz2
ENH: Improve FILE GLOB_RECURSE handling of symlinks with a new CMake policy. CMP0009 establishes NEW default behavior of not recursing through symlinks. OLD default behavior or explicit FOLLOW_SYMLINKS argument to FILE GLOB_RECURSE will still recurse through symlinks.
Diffstat (limited to 'Source/kwsys/Glob.cxx')
-rw-r--r--Source/kwsys/Glob.cxx9
1 files changed, 7 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);
}
}