4 ms·
The difference between Windows ".." and unixy ".." is that the former is done lexically whereas the latter is a link to the canonical parent. E.g. on Windows:
by ChrisSD 4y ago
The difference between Windows ".." and unixy ".." is that the former is done lexically whereas the latter is a link to the canonical parent.
E.g. on Windows: "path\to\..\file" is always the equivalent of "path\file". Whereas on unixy systems "path/to/../file" may take you to a completely different parent directory.
That said, Unix shells can muddy the waters a bit. They may choose to act lexically with some commands.
- rollcat 4y ago> E.g. on Windows: "path\to\..\file" is always the equivalent of "path\file". Whereas on unixy systems "path/to/../file" may take you to a completely different parent directory. Worth noting here that Plan 9 is using lexical names[1], and the Go standard library offers the function path.Clean[2] to achieve similar results. If your language/library/OS doesn't offer this behavior by default, it's likely a good idea to add/reimplement this function, unless you need bug-for-bug compatibility. [1]: https://web.archive.org/web/20220824070659/https://9p.io/sys/doc/lexnames.html https://web.archive.org/web/20220824070659/https://9p.io/sys... [2]: https://golang.bg/pkg/path/#Clean https://golang.bg/pkg/path/#Clean