From b883043c6a750576d959ad7cab775c41c6076cae Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Jun 2004 16:55:38 +0000 Subject: * generic/tclPathObj.c: Corrected [file tail] results when operating on a path produced by TclNewFSPathObj(). [Bug 970529] --- ChangeLog | 5 +++++ generic/tclPathObj.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 443fe2c..bfc5bf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-06-10 Don Porter + + * generic/tclPathObj.c: Corrected [file tail] results when operating + on a path produced by TclNewFSPathObj(). [Bug 970529] + 2004-06-09 Zoran Vasiljevic * 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; } -- cgit v0.12