summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx23
-rw-r--r--Source/cmSystemTools.h8
-rw-r--r--Source/kwsys/SystemTools.cxx23
-rw-r--r--Source/kwsys/SystemTools.hxx.in8
4 files changed, 31 insertions, 31 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);
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 7c6e3e9..00b4873 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -144,6 +144,14 @@ public:
const char *name,
const std::vector<std::string>& sourceExts);
+ /**
+ * Check if the given file exists in one of the parent directory of the
+ * given file or directory and if it does, return the name of the file.
+ * Toplevel specifies the top-most directory to where it will look.
+ */
+ static std::string FileExistsInParentDirectories(const char* fname,
+ const char* directory, const char* toplevel);
+
static void Glob(const char *directory, const char *regexp,
std::vector<std::string>& files);
static void GlobDirs(const char *fullPath, std::vector<std::string>& files);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 2dd3213..928dc37 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4000,29 +4000,6 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
return false;
}
-kwsys_stl::string SystemTools::FileExistsInParentDirectories(const char* fname,
- const char* directory, const char* toplevel)
-{
- kwsys_stl::string file = fname;
- SystemTools::ConvertToUnixSlashes(file);
- kwsys_stl::string dir = directory;
- SystemTools::ConvertToUnixSlashes(dir);
- while ( !dir.empty() )
- {
- kwsys_stl::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 "";
-}
-
void SystemTools::Delay(unsigned int msec)
{
#ifdef _WIN32
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 07118c2..31a876d 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -659,14 +659,6 @@ public:
const char *dir,
kwsys_stl::string& filename_found,
int try_filename_dirs = 0);
-
- /**
- * Check if the given file exists in one of the parent directory of the
- * given file or directory and if it does, return the name of the file.
- * Toplevel specifies the top-most directory to where it will look.
- */
- static kwsys_stl::string FileExistsInParentDirectories(const char* fname,
- const char* directory, const char* toplevel);
/** compute the relative path from local to remote. local must
be a directory. remote can be a file or a directory.