Re: Directory separators on Windows
| From: | Rowan Collins | Date: | Sun, 02 Apr 2017 18:28:48 +0000 |
| Subject: | Re: Directory separators on Windows | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98724@lists.php.net to get a copy of this message | ||
On 02/04/2017 09:09, Fleshgrinder wrote:
Your strategy works in these examples, but the example I gave was different. Imagine that we haveBoth strategies are equally valid, as long as you know which is in use. There are many common tools outside PHP which use both approaches, and situations where you might actually want the string-based approach, even if filesystem access is available. See for instance this discussion of pwd: http://unix.stackexchange.com/q/331208/70530 In summary, POSIX specifies "-L" (logical) which uses $PWD as set by the shell as you navigate, and "-P" (physical) which resolves backwards through the ".." links in the file system. The same is true for other operations - for instance, the below demo in bash shows one interpretation in "ls" and the other in "cd". /tmp/demo$ ls -lR .: drwxr-xr-x 2 vagrant vagrant 4096 Apr 2 18:21 foo drwxr-xr-x 3 vagrant vagrant 4096 Apr 2 18:05 other ./foo: lrwxrwxrwx 1 vagrant vagrant 21 Apr 2 18:21 bar -> /tmp/demo/other/thing ./other: drwxr-xr-x 2 vagrant vagrant 4096 Apr 2 18:06 thing /tmp/demo$ ls foo/bar/.. thing /tmp/demo$ cd foo/bar/.. /tmp/demo/foo$ ls bar Regards, -- Rowan Collins [IMSoP]/a/b/../cwhich we would normalize to/a/c. However, thebcomponent is actually a symbolic link tox/y. Hence, the real version of the path is/a/x/cand not/a/cas we would have normalized it to.