summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-04-21 15:36:59 (GMT)
committerBrad King <brad.king@kitware.com>2009-04-21 15:36:59 (GMT)
commit714d2fc04ba0ba7b455ab30602aef4ebc69ecf1b (patch)
tree1921cb354af2b2e40060adc8cbeab50e673d1a3e /Source/cmSystemTools.cxx
parent7bb8678fc649457deaac9527b785dbd43ee70928 (diff)
downloadCMake-714d2fc04ba0ba7b455ab30602aef4ebc69ecf1b.zip
CMake-714d2fc04ba0ba7b455ab30602aef4ebc69ecf1b.tar.gz
CMake-714d2fc04ba0ba7b455ab30602aef4ebc69ecf1b.tar.bz2
ENH: Remove obscure method from KWSys SystemTools
This removes SystemTools::FileExistsInParentDirectories from KWSys since it is a special-purpose method that is not generally useful.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 6ed45b1..d0aedd9 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1097,6 +1097,29 @@ bool cmSystemTools::DoesFileExistWithExtensions(
return false;
}
+std::string cmSystemTools::FileExistsInParentDirectories(const char* fname,
+ const char* directory, const char* toplevel)
+{
+ std::string file = fname;
+ SystemTools::ConvertToUnixSlashes(file);
+ std::string dir = directory;
+ SystemTools::ConvertToUnixSlashes(dir);
+ while ( !dir.empty() )
+ {
+ std::string path = dir + "/" + file;
+ if ( SystemTools::FileExists(path.c_str()) )
+ {
+ return path;
+ }
+ if ( dir.size() < strlen(toplevel) )
+ {
+ break;
+ }
+ dir = SystemTools::GetParentDirectory(dir.c_str());
+ }
+ return "";
+}
+
bool cmSystemTools::cmCopyFile(const char* source, const char* destination)
{
return Superclass::CopyFileAlways(source, destination);