summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Robot <kwrobot@kitware.com>2013-07-10 12:16:24 (GMT)
committerBrad King <brad.king@kitware.com>2013-07-11 13:03:59 (GMT)
commit0a44fa4c6c87c76d2adfa1edf68b9f2cfe2096cb (patch)
treef8e5d676dba03b28069fa283b92a33394719f413
parent2e3c9352848459c8822f9a1e858a613863e9ebc3 (diff)
downloadCMake-0a44fa4c6c87c76d2adfa1edf68b9f2cfe2096cb.zip
CMake-0a44fa4c6c87c76d2adfa1edf68b9f2cfe2096cb.tar.gz
CMake-0a44fa4c6c87c76d2adfa1edf68b9f2cfe2096cb.tar.bz2
KWSys 2013-07-10 (beef6819)
Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ beef6819 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' f6c4c247..beef6819 Brad King (1): beef6819 SystemTools: Implement IsSubDirectory without loop Change-Id: Ifab0c0384c7fbf1f9fc934918573a49b38f7bc0a
-rw-r--r--SystemTools.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 4d5af5e..935b836 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -4261,17 +4261,13 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
}
kwsys_stl::string subdir = cSubdir;
kwsys_stl::string dir = cDir;
+ SystemTools::ConvertToUnixSlashes(subdir);
SystemTools::ConvertToUnixSlashes(dir);
- kwsys_stl::string path = subdir;
- do
+ if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
{
- path = SystemTools::GetParentDirectory(path.c_str());
- if(SystemTools::ComparePath(dir.c_str(), path.c_str()))
- {
- return true;
- }
+ std::string s = subdir.substr(0, dir.size());
+ return SystemTools::ComparePath(s.c_str(), dir.c_str());
}
- while ( path.size() > dir.size() );
return false;
}