diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-25 08:08:05 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-06-25 08:08:05 (GMT) |
commit | 3759b05ed032d2795215249b406622f4e064f730 (patch) | |
tree | a937964246806dc7ac13f70b3ee539f6bb5ad598 /generic | |
parent | ef36cd63db3d03e2f96aa89f8575e01f15944fe2 (diff) | |
parent | 1b403491585909834fa1cdc86d326ed2d89f6710 (diff) | |
download | tcl-3759b05ed032d2795215249b406622f4e064f730.zip tcl-3759b05ed032d2795215249b406622f4e064f730.tar.gz tcl-3759b05ed032d2795215249b406622f4e064f730.tar.bz2 |
[Patch #1536227]: Cygwin network pathname support
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclFileName.c | 40 |
1 files changed, 23 insertions, 17 deletions
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; } |