diff options
author | dgp <dgp@noemail.net> | 2006-03-03 20:10:06 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2006-03-03 20:10:06 (GMT) |
commit | 62761ddce230ed3f7c78e49baa1fa0614f05d791 (patch) | |
tree | 2c5098fc0a848afcd5b6976b1a25bc3a6c4602d0 /generic/tclPathObj.c | |
parent | 0071071011eb2861ccc822a3bd30a352d8e62212 (diff) | |
download | tcl-62761ddce230ed3f7c78e49baa1fa0614f05d791.zip tcl-62761ddce230ed3f7c78e49baa1fa0614f05d791.tar.gz tcl-62761ddce230ed3f7c78e49baa1fa0614f05d791.tar.bz2 |
* generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287]
to work on Windows.
FossilOrigin-Name: 7ff6ad7556cf4a6747afd1cbaed4e594640ef368
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r-- | generic/tclPathObj.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 0cc577b..be530f5 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.50 2006/03/03 04:32:11 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.51 2006/03/03 20:10:09 dgp Exp $ */ #include "tclInt.h" @@ -162,8 +162,9 @@ TclFSNormalizeAbsolutePath( int first = 1; /* Set to zero once we've passed the first * directory separator - we can't use '..' to * remove the volume in a path. */ + int rootOffset; Tcl_Obj *retVal = NULL; - dirSep = TclGetString(pathPtr); + oldDirSep = dirSep = TclGetString(pathPtr); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (dirSep[0] != 0 && dirSep[1] == ':' && @@ -191,6 +192,7 @@ TclFSNormalizeAbsolutePath( * since we will have to expand the link to be able to back up one level. */ + rootOffset = dirSep - oldDirSep; while (*dirSep != 0) { oldDirSep = dirSep; if (!first) { @@ -318,9 +320,9 @@ TclFSNormalizeAbsolutePath( if (curLen == 0) { /* Attempt to .. beyond root becomes root: "/" */ if (dirSep[3] != 0) { - Tcl_SetObjLength(retVal, 0); + Tcl_SetObjLength(retVal, rootOffset); } else { - Tcl_SetObjLength(retVal, 1); + Tcl_SetObjLength(retVal, rootOffset+1); } } } |