3 ms·
> 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
by 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