Mercurial > projects > ldc
changeset 1193:c271eca933fb
Don't expand tilde ('~') in paths unless it's the first character of the path
in question.
This should fix #255.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 03 Apr 2009 16:35:47 +0200 |
parents | 3251ce06c820 |
children | 1853dcd9b944 |
files | dmd/root.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/root.c Fri Apr 03 16:34:11 2009 +0200 +++ b/dmd/root.c Fri Apr 03 16:35:47 2009 +0200 @@ -367,6 +367,8 @@ while (isspace(*p)) // skip leading whitespace p++; buf.reserve(strlen(p) + 1); // guess size of path + // LDC remember first character + const char* start = p; for (; ; p++) { c = *p; @@ -398,6 +400,9 @@ #if POSIX case '~': + // LDC don't expand unless first character of path + if (p != start) + goto Ldefault; buf.writestring(getenv("HOME")); continue; #endif @@ -407,6 +412,7 @@ if (!instring) // if not in string break; // treat as end of path default: + Ldefault: buf.writeByte(c); continue; }