summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclPathObj.c17
2 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 443fe2c..bfc5bf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclPathObj.c: Corrected [file tail] results when operating
+ on a path produced by TclNewFSPathObj(). [Bug 970529]
+
2004-06-09 Zoran Vasiljevic <vasiljevic@users.sf.net>
* generic/tclIOUtil.c: partially corrected [Bug 932314].
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 7a11e56..b27b6b5 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.32 2004/06/08 19:18:39 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.33 2004/06/10 16:55:39 dgp Exp $
*/
#include "tclInt.h"
@@ -518,6 +518,21 @@ TclPathPart(interp, pathPtr, portion)
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;
}