Tcl Source Code

Artifact [e7e3b3cc48]
Login

Artifact e7e3b3cc4820fdb9315eb0603902da0fc57d5c19:

Attachment "970529.patch" to ticket [970529ffff] added by dgp 2004-06-10 23:53:05.
Index: generic/tclPathObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPathObj.c,v
retrieving revision 1.32
diff -u -r1.32 tclPathObj.c
--- generic/tclPathObj.c	8 Jun 2004 19:18:39 -0000	1.32
+++ generic/tclPathObj.c	10 Jun 2004 16:51:31 -0000
@@ -518,6 +518,21 @@
 		    return fsPathPtr->cwdPtr;
 		}
 		case TCL_PATH_TAIL: {
+		    /* 
+		     * Check if the joined-on bit has any directory
+		     * delimiters in it.  If so, the 'tail' would
+		     * be only the part following the last delimiter.
+		     * We could handle that special case here, but we
+		     * don't, and instead just use the standardPath code.
+		     */
+		    CONST char *rest = Tcl_GetString(fsPathPtr->normPathPtr);
+		    if (strchr(rest, '/') != NULL) {
+			goto standardPath;
+		    }
+		    if ((tclPlatform == TCL_PLATFORM_WINDOWS) 
+		      && (strchr(rest, '\\') != NULL)) {
+			goto standardPath;
+		    }
 		    Tcl_IncrRefCount(fsPathPtr->normPathPtr);
 		    return fsPathPtr->normPathPtr;
 		}