]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/d/dmd/root/filename.c
PR d/91339
[thirdparty/gcc.git] / gcc / d / dmd / root / filename.c
index 6144d810fb5b6edea385c987eca530eb1ff6a767..ad6b1148c7b16e5e479fca1f808b485fd4f8b7e5 100644 (file)
@@ -110,7 +110,8 @@ Strings *FileName::splitPath(const char *path)
                     case '~':
                     {
                         char *home = getenv("HOME");
-                        if (home)
+                        // Expand ~ only if it is prefixing the rest of the path.
+                        if (!buf.offset && p[1] == '/' && home)
                             buf.writestring(home);
                         else
                             buf.writestring("~");