summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-22 12:07:28 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-22 12:07:28 (GMT)
commit39b1bc8eefca71fda1f8bebf08eee86cff6f5aec (patch)
tree205c7cbc0c445f67f3ef81c6269c65f13bc62661
parent687013812cd6ca56d2bfc1c0b75d98a6f8a2d264 (diff)
downloadtcl-39b1bc8eefca71fda1f8bebf08eee86cff6f5aec.zip
tcl-39b1bc8eefca71fda1f8bebf08eee86cff6f5aec.tar.gz
tcl-39b1bc8eefca71fda1f8bebf08eee86cff6f5aec.tar.bz2
Cygwin network pathname supportbug_1536227
-rw-r--r--generic/tclFileName.c34
-rw-r--r--tests/fileName.test6
2 files changed, 31 insertions, 9 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 4c57256..de91d81 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -414,9 +414,17 @@ TclpGetNativePathType(
}
#endif
if (path[0] == '/') {
+#ifdef __CYGWIN__
+ /*
+ * Check for Cygwin // network path prefix
+ */
+ if (path[1] == '/') {
+ path++;
+ }
+#endif
if (driveNameLengthPtr != NULL) {
/*
- * We need this addition in case the QNX code was used.
+ * We need this addition in case the QNX or Cygwin code was used.
*/
*driveNameLengthPtr = (1 + path - origPath);
@@ -643,11 +651,20 @@ SplitUnixPath(
}
#endif
- if (path[0] == '/') {
- Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj("/",1));
- p = path+1;
- } else {
- p = path;
+ p = path;
+ if (*p == '/') {
+ Tcl_Obj *rootElt = Tcl_NewStringObj("/", 1);
+ p++;
+#ifdef __CYGWIN__
+ /*
+ * Check for Cygwin // network path prefix
+ */
+ if (*p == '/') {
+ Tcl_AppendToObj(rootElt, "/", 1);
+ p++;
+ }
+#endif
+ Tcl_ListObjAppendElement(NULL, result, rootElt);
}
/*
@@ -2196,6 +2213,11 @@ DoGlob(
&& (strchr(separators, lastChar) == NULL))
|| ((length == 0) && (count > 0)))) {
Tcl_DStringAppend(&append, "/", 1);
+#ifdef __CYGWIN__
+ if ((length == 0) && (count > 1)) {
+ Tcl_DStringAppend(&append, "/", 1);
+ }
+#endif
}
break;
}
diff --git a/tests/fileName.test b/tests/fileName.test
index c613068..a91f4b3 100644
--- a/tests/fileName.test
+++ b/tests/fileName.test
@@ -189,7 +189,7 @@ test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} {
test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} {
testsetplatform unix
file split //foo
-} {/ foo}
+} "[file split //] foo"
test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} {
testsetplatform unix
file split foo//bar
@@ -429,11 +429,11 @@ test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} {
test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} {
testsetplatform unix
file join //a b
-} {/a/b}
+} "[file split //]a/b"
test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} {
testsetplatform unix
file join /// a b
-} {/a/b}
+} "[file split //]a/b"
test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} {