summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-09-13 20:38:35 (GMT)
committerBrad King <brad.king@kitware.com>2002-09-13 20:38:35 (GMT)
commit0815091e26718d078dd2b2b26984825beb47bac1 (patch)
treebbade4c91341ff3f1ee20c8ef2da43563f6b8a9c /Source/cmSystemTools.cxx
parentee592e9b9854f06d492cd5865678e6b67ca56c94 (diff)
downloadCMake-0815091e26718d078dd2b2b26984825beb47bac1.zip
CMake-0815091e26718d078dd2b2b26984825beb47bac1.tar.gz
CMake-0815091e26718d078dd2b2b26984825beb47bac1.tar.bz2
ENH: Added FileIsFullPath test method.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx33
1 files changed, 33 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)