diff options
author | dgp <dgp@users.sourceforge.net> | 2011-10-31 17:06:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-10-31 17:06:31 (GMT) |
commit | cf9df921f620da4fa43f83f17cee6b789c910002 (patch) | |
tree | 4dc6dab0786e1ed7df03bb95f5447f08f2c66792 /generic/tclPathObj.c | |
parent | 5ca626b4e6d4c45aa0ba1798b382251f70625de7 (diff) | |
parent | f756b0c2a727168bdc397f67c905951991e35a32 (diff) | |
download | tcl-cf9df921f620da4fa43f83f17cee6b789c910002.zip tcl-cf9df921f620da4fa43f83f17cee6b789c910002.tar.gz tcl-cf9df921f620da4fa43f83f17cee6b789c910002.tar.bz2 |
3414754 Fix the PATHFLAGS != 0 intrep normalizing trailing slashes.
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r-- | generic/tclPathObj.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 8840e4a..eb19096 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1367,37 +1367,20 @@ AppendPath( const char *bytes; Tcl_Obj *copy = Tcl_DuplicateObj(head); - bytes = Tcl_GetStringFromObj(copy, &numBytes); - /* - * Should we perhaps use 'Tcl_FSPathSeparator'? But then what about the - * Windows special case? Perhaps we should just check if cwd is a root - * volume. We should never get numBytes == 0 in this code path. + * This is likely buggy when dealing with virtual filesystem drivers + * that use some character other than "/" as a path separator. I know + * of no evidence that such a foolish thing exists. This solution was + * chosen so that "JoinPath" operations that pass through either path + * intrep produce the same results; that is, bugward compatibility. If + * we need to fix that bug here, it needs fixing in Tcl_FSJoinPath() too. */ - - switch (tclPlatform) { - case TCL_PLATFORM_UNIX: - if (bytes[numBytes-1] != '/') { - Tcl_AppendToObj(copy, "/", 1); - } - break; - - case TCL_PLATFORM_WINDOWS: - /* - * We need the extra 'numBytes != 2', and ':' checks because a volume - * relative path doesn't get a '/'. For example 'glob C:*cat*.exe' - * will return 'C:cat32.exe' - */ - - if (bytes[numBytes-1] != '/' && bytes[numBytes-1] != '\\') { - if (numBytes!= 2 || bytes[1] != ':') { - Tcl_AppendToObj(copy, "/", 1); - } - } - break; + bytes = Tcl_GetStringFromObj(tail, &numBytes); + if (numBytes == 0) { + Tcl_AppendToObj(copy, "/", 1); + } else { + TclpNativeJoinPath(copy, bytes); } - - Tcl_AppendObjToObj(copy, tail); return copy; } |