]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Win32: make_relative_path also accept /c/users (#455)
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:12:45 +0000 (19:12 +0200)
Patch copied from jd-gascuel@f3b85c9

(cherry picked from commit 1fa9f0c8130177578020cdb89b9c93792f42400e)

src/ccache.c

index ca3b961ab671c2ea5ca5c5756425ab3da62b1e6c..6204ce2124f6b46310cea5f8c6fbb65ff94e4d02 100644 (file)
@@ -791,7 +791,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