# HG changeset patch # User Frits van Bommel # Date 1238769347 -7200 # Node ID c271eca933fb9f74362b111b24fac3e23915362f # Parent 3251ce06c820ea618bce67a00d33db5229783978 Don't expand tilde ('~') in paths unless it's the first character of the path in question. This should fix #255. diff -r 3251ce06c820 -r c271eca933fb dmd/root.c --- 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; }