summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-25 08:08:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-06-25 08:08:05 (GMT)
commit076eb7c9e473f60d3821b1fcc622f69fbb8eba14 (patch)
treea937964246806dc7ac13f70b3ee539f6bb5ad598
parent54bdc7613fcce8f2394851d92ac54f1fd7820db9 (diff)
parent3b5f5de0a5c31cd0891ca0398b8573ce3e7111b8 (diff)
downloadtcl-076eb7c9e473f60d3821b1fcc622f69fbb8eba14.zip
tcl-076eb7c9e473f60d3821b1fcc622f69fbb8eba14.tar.gz
tcl-076eb7c9e473f60d3821b1fcc622f69fbb8eba14.tar.bz2
[Patch #1536227]: Cygwin network pathname support
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclFileName.c40
-rw-r--r--tests/fileName.test6
3 files changed, 31 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 27cc745..e7f5fc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-25 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tclfileName.c: [Patch #1536227]: Cygwin network pathname
+ * tests/fileName.test: support
+
2012-06-23 Jan Nijtmans <nijtmans@users.sf.net>
* unix/tclUnixNotfy.c: [Bug 3508771]: Cygwin notifier for handling
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index b130169..48c5454 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -424,9 +424,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);
@@ -653,11 +661,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);
}
/*
@@ -2400,17 +2417,6 @@ DoGlob(
Tcl_DStringAppend(&append, ".", 1);
}
}
-#if defined(__CYGWIN__) && !defined(__WIN32__)
- {
- DLLIMPORT extern int cygwin_conv_to_posix_path(const char *,
- char *);
- char winbuf[MAXPATHLEN+1];
-
- cygwin_conv_to_posix_path(Tcl_DStringValue(&append), winbuf);
- Tcl_DStringFree(&append);
- Tcl_DStringAppend(&append, winbuf, -1);
- }
-#endif /* __CYGWIN__ && __WIN32__ */
break;
}
diff --git a/tests/fileName.test b/tests/fileName.test
index affacff..251f12c 100644
--- a/tests/fileName.test
+++ b/tests/fileName.test
@@ -196,7 +196,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
@@ -433,11 +433,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} {
testsetplatform win