Determine absolute paths the correct way :)
authorJeff Cohen <jeffc@jolt-lang.org>
Thu, 29 Mar 2007 17:27:38 +0000 (17:27 +0000)
committerJeff Cohen <jeffc@jolt-lang.org>
Thu, 29 Mar 2007 17:27:38 +0000 (17:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35464 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Win32/Path.inc

index f5edaa07edbd98b6a4757f2cdf5bb1bb6284249b..5bb2e39e949b11c6ec6af6abaf15690c7e81b59a 100644 (file)
@@ -107,9 +107,15 @@ Path::isValid() const {
 
 bool 
 Path::isAbsolute() const {
-  if (path.length() < 3)
-    return false;
-  return path[0] == 'C' && path[1] == ':' && path[2] == '\\';
+  switch (path.length()) {
+    case 0:
+      return false;
+    case 1:
+    case 2:
+      return path[0] == '/';
+    default:
+      return path[0] == '/' || (path[1] == ':' && path[2] == '/');
+  }
 } 
 
 static Path *TempDirectory = NULL;