diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-10-04 16:01:57 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-10-04 16:01:57 (GMT) |
commit | f852823f2d4d5f92dee67e03cbdc4da22d8be30b (patch) | |
tree | 593e2656e33a3906d65c33734840fbb1b9bae6e4 | |
parent | 3f371a5084c05daba396645abd9a25deb3d023d1 (diff) | |
parent | 49c9b2444c871d10db7b756b17827f435d5f96d1 (diff) | |
download | tcl-f852823f2d4d5f92dee67e03cbdc4da22d8be30b.zip tcl-f852823f2d4d5f92dee67e03cbdc4da22d8be30b.tar.gz tcl-f852823f2d4d5f92dee67e03cbdc4da22d8be30b.tar.bz2 |
TIP 402: General Platform UNC Support
-rw-r--r-- | doc/filename.n | 3 | ||||
-rw-r--r-- | doc/ledit.n | 2 | ||||
-rw-r--r-- | generic/tclFileName.c | 28 | ||||
-rw-r--r-- | tests/cmdAH.test | 10 | ||||
-rw-r--r-- | tests/fileName.test | 6 | ||||
-rw-r--r-- | tests/fileSystem.test | 6 |
6 files changed, 15 insertions, 40 deletions
diff --git a/doc/filename.n b/doc/filename.n index 7b9d6fa..335d8c7 100644 --- a/doc/filename.n +++ b/doc/filename.n @@ -47,7 +47,8 @@ absolute, and file names may contain any character other than slash. The file names \fB\&.\fR and \fB\&..\fR are special and refer to the current directory and the parent of the current directory respectively. Multiple adjacent slash characters are interpreted as a single -separator. Any number of trailing slash characters at the end of a +separator, except for the first double slash \fB//\fR in absolute paths. +Any number of trailing slash characters at the end of a path are simply ignored, so the paths \fBfoo\fR, \fBfoo/\fR and \fBfoo//\fR are all identical, and in particular \fBfoo/\fR does not necessarily mean a directory is being referred. diff --git a/doc/ledit.n b/doc/ledit.n index 48e6da5..70e0bf3 100644 --- a/doc/ledit.n +++ b/doc/ledit.n @@ -18,7 +18,7 @@ ledit \- Replace elements of a list stored in variable The command fetches the list value in variable \fIlistVar\fR and replaces the elements in the range given by indices \fIfirst\fR to \fIlast\fR (inclusive) with the \fIvalue\fR arguments. The resulting list is then stored back in -\fIlistVar\fR and returned as the result of the command. +\fIlistVar\fR and returned as the result of the command. .PP Arguments \fIfirst\fR and \fIlast\fR are index values specifying the first and last elements of the range to replace. They are interpreted diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 9620f8c..b553621 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -413,7 +413,6 @@ TclpGetNativePathType( if (path[0] == '/') { ++path; -#if defined(__CYGWIN__) || defined(__QNX__) /* * Check for "//" network path prefix */ @@ -422,22 +421,10 @@ TclpGetNativePathType( while (*path && *path != '/') { ++path; } -#if defined(__CYGWIN__) - /* UNC paths need to be followed by a share name */ - if (*path++ && (*path && *path != '/')) { - ++path; - while (*path && *path != '/') { - ++path; - } - } else { - path = origPath + 1; - } -#endif } -#endif if (driveNameLengthPtr != NULL) { /* - * We need this addition in case the QNX or Cygwin code was used. + * We need this addition in case the "//" code was used. */ *driveNameLengthPtr = (path - origPath); @@ -656,7 +643,6 @@ SplitUnixPath( if (*path == '/') { Tcl_Obj *rootElt; ++path; -#if defined(__CYGWIN__) || defined(__QNX__) /* * Check for "//" network path prefix */ @@ -665,19 +651,7 @@ SplitUnixPath( while (*path && *path != '/') { ++path; } -#if defined(__CYGWIN__) - /* UNC paths need to be followed by a share name */ - if (*path++ && (*path && *path != '/')) { - ++path; - while (*path && *path != '/') { - ++path; - } - } else { - path = origPath + 1; - } -#endif } -#endif rootElt = Tcl_NewStringObj(origPath, path - origPath); Tcl_ListObjAppendElement(NULL, result, rootElt); while (*path == '/') { diff --git a/tests/cmdAH.test b/tests/cmdAH.test index a9e199e..2a8f71a 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -439,19 +439,19 @@ test cmdAH-8.13 {Tcl_FileObjCmd: dirname} testsetplatform { test cmdAH-8.14 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname //foo -} / +} //foo test cmdAH-8.15 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname //foo/bar -} /foo +} //foo test cmdAH-8.16 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname {//foo\/bar/baz} -} {/foo\/bar} +} {//foo\/bar} test cmdAH-8.17 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname {//foo\/bar/baz/blat} -} {/foo\/bar/baz} +} {//foo\/bar/baz} test cmdAH-8.18 {Tcl_FileObjCmd: dirname} testsetplatform { testsetplatform unix file dirname /foo// @@ -583,7 +583,7 @@ test cmdAH-9.13 {Tcl_FileObjCmd: tail} testsetplatform { test cmdAH-9.14 {Tcl_FileObjCmd: tail} testsetplatform { testsetplatform unix file tail //foo -} foo +} {} test cmdAH-9.15 {Tcl_FileObjCmd: tail} testsetplatform { testsetplatform unix file tail //foo/bar diff --git a/tests/fileName.test b/tests/fileName.test index 04273d7..575a17f 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -201,7 +201,7 @@ test filename-4.12 {Tcl_SplitPath: unix} {testsetplatform} { test filename-4.13 {Tcl_SplitPath: unix} {testsetplatform} { testsetplatform unix file split //foo -} "/ foo" +} "//foo" test filename-4.14 {Tcl_SplitPath: unix} {testsetplatform} { testsetplatform unix file split foo//bar @@ -438,14 +438,14 @@ test filename-7.16 {Tcl_JoinPath: unix} {testsetplatform} { test filename-7.17 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix file join //a b -} "/a/b" +} "//a/b" test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix file join /// a b } "/a/b" test filename-7.19 {[Bug f34cf83dd0]} { file join foo //bar -} /bar +} //bar test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} { testsetplatform win diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 0b53be5..2bbf981 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -379,13 +379,13 @@ test filesystem-1.51 {file normalisation .. beyond root (Bug 1379287)} { test filesystem-1.51.1 {file normalisation .. beyond root (Bug 1379287)} { testPathEqual [file norm /../../] [file norm /] } ok -test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -constraints unix -body { - set x //foo +test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -body { + set x ///foo file normalize $x file join $x bar } -result /foo/bar test filesystem-1.52.1 {bug f9f390d0fa: file join where strep is not canonical} -body { - set x //foo + set x ///foo file normalize $x file join $x } -result /foo |