From 1867a443a7465499ed1ac544e3d9d8a2b547843b Mon Sep 17 00:00:00 2001 From: vincentdarley Date: Mon, 8 Aug 2005 23:20:08 +0000 Subject: file rootname bug fix --- ChangeLog | 5 +++++ generic/tclPathObj.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 410a4c9..d0a430d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-09 Vince Darley + + * generic/tclPathObj.c: fix to [file rootname] bug in optimized + code path reported on comp.lang.tcl. + 2005-08-06 Donal K. Fellows * generic/tclThreadStorage.c: Stop exposing the guts of the thread diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 362d489..96190d0 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.42 2005/07/21 14:38:50 dkf Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.43 2005/08/08 23:20:11 vincentdarley Exp $ */ #include "tclInt.h" @@ -572,7 +572,6 @@ TclPathPart(interp, pathPtr, portion) case TCL_PATH_EXTENSION: return GetExtension(fsPathPtr->normPathPtr); case TCL_PATH_ROOT: { - /* Unimplemented */ CONST char *fileName, *extension; int length; @@ -607,6 +606,10 @@ TclPathPart(interp, pathPtr, portion) Tcl_SetObjLength(fsDupPtr->normPathPtr, (int)(length - strlen(extension))); } + if (root->bytes != NULL && root->length > 0) { + /* Have string rep as well */ + root->length -= strlen(extension); + } return root; } } -- cgit v0.12