diff options
-rw-r--r-- | win/tclWinFile.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6195c18..b12fb2a 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.31 2002/06/13 09:40:02 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.32 2002/06/13 10:43:41 vincentdarley Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -2166,6 +2166,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) lastValidPathEnd = currentPathEndPosition; Tcl_DStringFree(&ds); } else { + int isDrive = 1; Tcl_DStringFree(&ds); currentPathEndPosition = path + nextCheckpoint; while (1) { @@ -2187,7 +2188,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) * Check for symlinks, except at last component * of path (we don't follow final symlinks) */ - if (cur != 0 && (data.dwFileAttributes + if (cur != 0 && !isDrive && (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) { Tcl_Obj *to = WinReadLinkDirectory(nativePath); if (to != NULL) { @@ -2218,6 +2219,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) if (cur == 0) { break; } + /* + * If we get here, we've got past one directory + * delimiter, so we know it is no longer a drive + */ + isDrive = 0; } currentPathEndPosition++; } @@ -2249,8 +2255,11 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) if (ConvertFileNameFormat(interp, 0, tmpPathPtr, 1, &objPtr) == TCL_OK) { int len; - (void) Tcl_GetStringFromObj(objPtr,&len); + CONST char* converted = Tcl_GetStringFromObj(objPtr,&len); if (!endOfString) { + if (converted[len-1] == '/') { + lastValidPathEnd++; + } /* Be nice and fix the string before we clear it */ Tcl_AppendToObj(objPtr, lastValidPathEnd, -1); } |