summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-10-31 19:16:36 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-10-31 19:16:36 (GMT)
commit38a1f6c276f00c641bb85a2c5281a917c20fe0b4 (patch)
tree9652ac9335212f5c86c596cd6f96b61b49a8d399 /generic
parent02c0293a129623c23d58a9e2c18dd5966ee07af7 (diff)
parentcf9df921f620da4fa43f83f17cee6b789c910002 (diff)
downloadtcl-38a1f6c276f00c641bb85a2c5281a917c20fe0b4.zip
tcl-38a1f6c276f00c641bb85a2c5281a917c20fe0b4.tar.gz
tcl-38a1f6c276f00c641bb85a2c5281a917c20fe0b4.tar.bz2
merge to release
Diffstat (limited to 'generic')
-rw-r--r--generic/tclFileName.c5
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclPathObj.c39
3 files changed, 15 insertions, 31 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index a8c4f42..26587ee 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -823,10 +823,11 @@ Tcl_FSJoinToPath(
void
TclpNativeJoinPath(
Tcl_Obj *prefix,
- char *joining)
+ const char *joining)
{
int length, needsSep;
- char *dest, *p, *start;
+ const char *p;
+ char *dest, *start;
start = Tcl_GetStringFromObj(prefix, &length);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 854404f..e1ce6d5 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2741,7 +2741,7 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
Tcl_DString *dirPtr, char *pattern, char *tail);
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
Tcl_Obj *pathPtr, int nextCheckpoint);
-MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, char *joining);
+MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining);
MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr);
MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr,
int *driveNameLengthPtr, Tcl_Obj **driveNameRef);
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 8840e4a..eb19096 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -1367,37 +1367,20 @@ AppendPath(
const char *bytes;
Tcl_Obj *copy = Tcl_DuplicateObj(head);
- bytes = Tcl_GetStringFromObj(copy, &numBytes);
-
/*
- * Should we perhaps use 'Tcl_FSPathSeparator'? But then what about the
- * Windows special case? Perhaps we should just check if cwd is a root
- * volume. We should never get numBytes == 0 in this code path.
+ * This is likely buggy when dealing with virtual filesystem drivers
+ * that use some character other than "/" as a path separator. I know
+ * of no evidence that such a foolish thing exists. This solution was
+ * chosen so that "JoinPath" operations that pass through either path
+ * intrep produce the same results; that is, bugward compatibility. If
+ * we need to fix that bug here, it needs fixing in Tcl_FSJoinPath() too.
*/
-
- switch (tclPlatform) {
- case TCL_PLATFORM_UNIX:
- if (bytes[numBytes-1] != '/') {
- Tcl_AppendToObj(copy, "/", 1);
- }
- break;
-
- case TCL_PLATFORM_WINDOWS:
- /*
- * We need the extra 'numBytes != 2', and ':' checks because a volume
- * relative path doesn't get a '/'. For example 'glob C:*cat*.exe'
- * will return 'C:cat32.exe'
- */
-
- if (bytes[numBytes-1] != '/' && bytes[numBytes-1] != '\\') {
- if (numBytes!= 2 || bytes[1] != ':') {
- Tcl_AppendToObj(copy, "/", 1);
- }
- }
- break;
+ bytes = Tcl_GetStringFromObj(tail, &numBytes);
+ if (numBytes == 0) {
+ Tcl_AppendToObj(copy, "/", 1);
+ } else {
+ TclpNativeJoinPath(copy, bytes);
}
-
- Tcl_AppendObjToObj(copy, tail);
return copy;
}