diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclPathObj.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 161d7de..ba8d155 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.54 2006/04/06 16:43:03 dgp Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.55 2006/04/07 14:05:29 dgp Exp $ */ #include "tclInt.h" @@ -213,13 +213,17 @@ TclFSNormalizeAbsolutePath( /* * Need to skip '.' in the path. */ + int curLen; if (retVal == NULL) { CONST char *path = TclGetString(pathPtr); - retVal = Tcl_NewStringObj(path, dirSep - path - + (dirSep == path)); + retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } + Tcl_GetStringFromObj(retVal, &curLen); + if (curLen == 0) { + Tcl_AppendToObj(retVal, dirSep, 1); + } dirSep += 2; oldDirSep = dirSep; if (dirSep[0] != 0 && dirSep[1] == '.') { @@ -238,10 +242,13 @@ TclFSNormalizeAbsolutePath( if (retVal == NULL) { CONST char *path = TclGetString(pathPtr); - retVal = Tcl_NewStringObj(path, dirSep - path - + (dirSep == path)); + retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } + Tcl_GetStringFromObj(retVal, &curLen); + if (curLen == 0) { + Tcl_AppendToObj(retVal, dirSep, 1); + } if (!first || (tclPlatform == TCL_PLATFORM_UNIX)) { link = Tcl_FSLink(retVal, NULL, 0); if (link != NULL) { |