summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmSystemTools.cxx33
-rw-r--r--Source/cmSystemTools.h3
2 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 2e17358..6139292 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1900,6 +1900,39 @@ cmSystemTools::GetFilenameWithoutLastExtension(const std::string& filename)
}
}
+bool cmSystemTools::FileIsFullPath(const char* in_name)
+{
+ std::string name = in_name;
+#if defined(_WIN32)
+ // On Windows, the name must be at least two characters long.
+ if(name.length() < 2)
+ {
+ return false;
+ }
+ if(name[1] == ':')
+ {
+ return true;
+ }
+ if(name[0] == '\\')
+ {
+ return true;
+ }
+#else
+ // On UNIX, the name must be at least one character long.
+ if(name.length() < 1)
+ {
+ return false;
+ }
+#endif
+ // On UNIX, the name must begin in a '/'.
+ // On Windows, if the name begins in a '/', then it is a full
+ // network path.
+ if(name[0] == '/')
+ {
+ return true;
+ }
+ return false;
+}
void cmSystemTools::Glob(const char *directory, const char *regexp,
std::vector<std::string>& files)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 0ef9b6f..229232f 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -258,6 +258,9 @@ public:
///! return file name without its last (shortest) extension.
static std::string GetFilenameWithoutLastExtension(const std::string&);
+ /** Return whether the path represents a full path (not relative). */
+ static bool FileIsFullPath(const char*);
+
static long int ModifiedTime(const char* filename);
/**