diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclFileName.c | 40 | ||||
-rw-r--r-- | tests/fileName.test | 6 |
3 files changed, 31 insertions, 20 deletions
@@ -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 |