diff dmd/root/root.c @ 1195:e961851fb8be

Merged DMD 1.042.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 03 Apr 2009 17:59:34 +0200
parents 1853dcd9b944
children 7af860e4f403
line wrap: on
line diff
--- a/dmd/root/root.c	Fri Apr 03 17:02:52 2009 +0200
+++ b/dmd/root/root.c	Fri Apr 03 17:59:34 2009 +0200
@@ -583,9 +583,17 @@
 	       return e + 1;
 
 #if _WIN32
+	    case '/':
 	    case '\\':
+		return e + 1;
 	    case ':':
-		return e + 1;
+		/* The ':' is a drive letter only if it is the second
+		 * character or the last character,
+		 * otherwise it is an ADS (Alternate Data Stream) separator.
+		 * Consider ADS separators as part of the file name.
+		 */
+		if (e == str + 1 || e == str + len - 1)
+		    return e + 1;
 #endif
 	    default:
 		if (e == str)
@@ -620,7 +628,7 @@
 	    n--;
 
 #if _WIN32
-	if (n[-1] == '\\')
+	if (n[-1] == '\\' || n[-1] == '/')
 	    n--;
 #endif
     }
@@ -822,8 +830,8 @@
 	    if (*p)
 	    {
 #if _WIN32
-		size_t len = strlen(p);
-		if (len > 2 && p[-1] == ':')
+		size_t len = strlen(path);
+		if (len > 2 && p[-1] == ':' && path + 2 == p)
 		{   mem.free(p);
 		    return;
 		}