diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIOUtil.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 52bec32..e82efa5 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.97 2004/03/30 15:35:46 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.98 2004/04/01 11:13:01 vincentdarley Exp $ */ #include "tclInt.h" @@ -1161,13 +1161,30 @@ FsAddMountsToGlobResult(result, pathPtr, pattern, types) } } if (!found && dir) { + int len, mlen; + CONST char *path; + CONST char *mount; if (Tcl_IsShared(result)) { Tcl_Obj *newList; newList = Tcl_DuplicateObj(result); Tcl_DecrRefCount(result); result = newList; } - Tcl_ListObjAppendElement(NULL, result, mElt); + /* + * We know mElt is absolute normalized and lies inside pathPtr, + * so now we must add to the result the right + * representation of mElt, i.e. the representation which + * is relative to pathPtr. + */ + mount = Tcl_GetStringFromObj(mElt, &mlen); + path = Tcl_GetStringFromObj(Tcl_FSGetNormalizedPath(NULL, pathPtr), + &len); + if (path[len-1] == '/') { + /* Deal with the root of the volume */ + len--; + } + mElt = TclNewFSPathObj(pathPtr, mount + len + 1, mlen - len); + Tcl_ListObjAppendElement(NULL, result, mElt); /* * No need to increment gLength, since we * don't want to compare mounts against |