summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclFileName.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index aba17d7..00f58d0 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.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: tclFileName.c,v 1.60 2004/10/07 14:50:21 vincentdarley Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.61 2005/01/17 10:40:34 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -1933,7 +1933,7 @@ static int
DoGlob(interp, matchesObj, separators, pathPtr, flags, pattern, types)
Tcl_Interp *interp; /* Interpreter to use for error reporting
* (e.g. unmatched brace). */
- Tcl_Obj *matchesObj; /* Unshared list object in which to place all
+ Tcl_Obj *matchesObj; /* Unshared list object in which to place all
* resulting filenames. Caller allocates and
* deallocates; DoGlob must not touch the
* refCount of this object. */
@@ -2259,6 +2259,14 @@ DoGlob(interp, matchesObj, separators, pathPtr, flags, pattern, types)
Tcl_DStringLength(&append));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
+ if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
+ /* The current prefix must end in a separator */
+ int len;
+ CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
+ if (strchr(separators, joined[len-1]) == NULL) {
+ Tcl_AppendToObj(joinedPtr, "/", 1);
+ }
+ }
Tcl_AppendToObj(joinedPtr, Tcl_DStringValue(&append),
Tcl_DStringLength(&append));
}
@@ -2279,6 +2287,14 @@ DoGlob(interp, matchesObj, separators, pathPtr, flags, pattern, types)
joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern);
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
+ if (strchr(separators, pattern[0]) == NULL) {
+ /* The current prefix must end in a separator */
+ int len;
+ CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len);
+ if (strchr(separators, joined[len-1]) == NULL) {
+ Tcl_AppendToObj(joinedPtr, "/", 1);
+ }
+ }
Tcl_AppendToObj(joinedPtr, pattern, p-pattern);
}