]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Win32: make_relative_path also accept /c/users (#455) 470/head
authorCristian Adam <cristian.adam@gmail.com>
Wed, 28 Aug 2019 17:07:21 +0000 (19:07 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 28 Aug 2019 17:07:21 +0000 (19:07 +0200)
Patch copied from jd-gascuel@f3b85c9

src/ccache.cpp

index 26433531908c3d746e6b1ff0bce5eb7ed71515d8..8568d405aa07280b77d9a70b2bef1bb750f2b2c7 100644 (file)
@@ -772,7 +772,15 @@ make_relative_path(char* path)
 
 #ifdef _WIN32
   if (path[0] == '/') {
-    path++; // Skip leading slash.
+    char *p = NULL;
+    if (isalpha(path[1]) && path[2] == '/') {
+      // Transform /c/path... to c:/path...
+      p = format("%c:/%s", path[1], &path[3]);
+    } else {
+      p = x_strdup(path+1); // Skip leading slash.
+    }
+    free(path);
+    path = p;
   }
 #endif