Re:Why Does Windows Really Use Backslash as Path Separator?
by saagarjha on Friday May 24, 2019 @04:54PM
(#20005202)
And for this reason you still can't name your file ":" in Finder today.
[ Parent
| on HN ]
Re:Why Does Windows Really Use Backslash as Path Separator?
by klodolph on Friday May 24, 2019 @06:14PM
(#20005757)
You can name it "/", though. If you look at it in the terminal, it will be named ":".
Re:Why Does Windows Really Use Backslash as Path Separator?
by saagarjha on Friday May 24, 2019 @06:17PM
(#20005778)
And amusingly, if you create a file named ":" from the Terminal, it'll show up as "/" in Finder :)
Re:Why Does Windows Really Use Backslash as Path Separator?
by ComputerGuru on Friday May 24, 2019 @06:13PM
(#20005751)
$PATH breaks under most implementations even under Linux or BSD with that. It shouldn't; though.
Re:Why Does Windows Really Use Backslash as Path Separator?
by wahern on Friday May 24, 2019 @10:42PM
(#20006787)
That's because the only special characters in file paths in Unix are / and NUL. You can't pass NUL through environment variables, both because of the C API for manipulating environment variables and how the environment is passed to the host program by the kernel--environment variables are delimited by NUL, as are argv arguments, and the argv and environ lists are delimited by a double NUL. So the shell had to pick some random delimiter, and whatever it chose would conflict with existing path semantics. Fortunately, it only effects the semantics of PATH--the colon is irrelevant everywhere else, and PATH isn't strictly necessary for anything, not even in the shell.
There's no easy way to fix that. I suppose PATH could instead be split into PATH_1, PATH_2, PATH_3, etc, with a single path per environment variable. I've used such a solution to emulate arrays for both internal and environment variables. But that ship sailed a long time ago: the semantics of PATH are built into the shell, libc (because libc's execvp, etc are what traverse $PATH looking for an executable, not the kernel), countless other programs, not to mention the POSIX standard itself.
Re:Why Does Windows Really Use Backslash as Path Separator?
by kurtisc on Saturday May 25, 2019 @06:22AM
(#20008161)
Fish shell gets around this by using a list for it
Re:Why Does Windows Really Use Backslash as Path Separator?
by ComputerGuru on Saturday May 25, 2019 @01:24PM
(#20010157)
Yessir. (fish core dev here ;)