summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclPathObj.c16
-rw-r--r--tests/fileSystem.test7
3 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e80ea65..c1bcda1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-11-22 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tclPathObj.c: fix and new test for [Bug 1043129] in
+ * tests/fileSystem.test: the treatment of backslashes in file
+ join on Windows.
+
2004-11-21 Don Porter <dgp@users.sourceforge.net>
* doc/AddErrInfo.3: Typo corrections (Thanks Daniel South).
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 26d5e70..2ed8eed 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.37 2004/10/07 14:50:23 vincentdarley Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.38 2004/11/22 12:53:06 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -842,10 +842,18 @@ Tcl_FSJoinPath(listObj, elements)
if (str[0] != '.' && ((tclPlatform != TCL_PLATFORM_WINDOWS)
|| (strchr(str, '\\') == NULL))) {
- if (res != NULL) {
- TclDecrRefCount(res);
+ /*
+ * Finally, on Windows, 'file join' is defined to
+ * convert all backslashes to forward slashes,
+ * so the base part cannot have backslashes either.
+ */
+ if ((tclPlatform != TCL_PLATFORM_WINDOWS)
+ || (strchr(Tcl_GetString(elt), '\\') == NULL)) {
+ if (res != NULL) {
+ TclDecrRefCount(res);
+ }
+ return TclNewFSPathObj(elt, str, len);
}
- return TclNewFSPathObj(elt, str, len);
}
/*
diff --git a/tests/fileSystem.test b/tests/fileSystem.test
index 44ba612..17cc0dd 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -913,6 +913,13 @@ test filesystem-9.5 {path objects and file tail and object rep} {
cd $origdir
set res
} {test test}
+test filesystem-9.6 {path objects and file tail and object rep} {winOnly} {
+ set res {}
+ set p "C:\\toto"
+ lappend res [file join $p toto]
+ file isdirectory $p
+ lappend res [file join $p toto]
+} {C:/toto/toto C:/toto/toto}
cleanupTests
unset -nocomplain drive