diff options
author | dgp <dgp@users.sourceforge.net> | 2006-03-03 20:10:07 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-03-03 20:10:07 (GMT) |
commit | 582550ff6d9cb4106e887545d6fa3805303de2c1 (patch) | |
tree | 2c5098fc0a848afcd5b6976b1a25bc3a6c4602d0 | |
parent | 123991e14661143522122cc5441e238b679414e3 (diff) | |
download | tcl-582550ff6d9cb4106e887545d6fa3805303de2c1.zip tcl-582550ff6d9cb4106e887545d6fa3805303de2c1.tar.gz tcl-582550ff6d9cb4106e887545d6fa3805303de2c1.tar.bz2 |
* generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287]
to work on Windows.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclPathObj.c | 10 |
2 files changed, 10 insertions, 5 deletions
@@ -1,4 +1,7 @@ -2006-03-02 Don Porter <dgp@users.sourceforge.net> +2006-03-03 Don Porter <dgp@users.sourceforge.net> + + * generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287] + to work on Windows. * generic/tclObj.c: Compatibility support for existing code that calls Tcl_GetObjType("boolean"). 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); } } } |