5 ms·
Sadly, you are not correct about slashes. They are allowed in filenames for Macs https://alexwlchan.net/2021/slashes/ https://alexwlchan.net/2021/slashes/
by slaymaker1907 3y ago
Sadly, you are not correct about slashes. They are allowed in filenames for Macs https://alexwlchan.net/2021/slashes/ https://alexwlchan.net/2021/slashes/
- vtee44 3y agoIt doesn’t make sense tbh, it just causes confusion when someone is using terminal. Slashes in file names are forbidden everywhere except Mac, it needs to be changed in order to send it anywhere or use in some apps. But I think colon is used much more in names. I don’t get why did they do that.
- lostlogin 3y agoBased on this logic, do we ban everything that is banned somewhere? Surely we can aim higher than the lowest common denominator.
- vtee44 3y agoSlashes are used in paths, so most programs that aren’t Mac-exclusive would use them to build a path to file. To make it work properly in cross-platform programs you’d need to write platform-specific code to handle that. It just adds complexity and possible errors. Even system terminal doesn’t display it as slash and it doesn’t work if you write slashes. For users of other platforms (at least 90% of desktop market) it would just display as slashes. Just not implementing this workaround would make it predictable when moving and using files.
- wizofaus 3y agoGiven the preponderance of 3 major operating systems, I'd think it's sensible for user-level applications to disallow creation of filenames that would cause problems on any of them. Except arguably that could even include using spaces or periods... obviously in an ideal world such restrictions wouldn't exist, but I'm not sure how to realistically push for such a world. E.g. my suggestion would be to reserve non-printable characters (below Ascii 32) for use as separators/delimiters in as many contexts where that's workable. Obviously some sort of convention would then need to exist as to how they were displayed and typed in, and I very much doubt I'll ever see it happen, but I'm sure it would solve a lot of mis-parsing bugs that show up with frustrating regularity.
- lostlogin 3y agoI suppose I’m actually criticising Microsoft and the backwards compatibility that is now dictating practices due to long gone limitations. It is painful being forced up update things due to software changing underneath you, but there must be a middle road.
- slaymaker1907 3y agoI see your point, but forbidding slashes, the weird Windows reserved names, maintaining case insensitivity (also Windows), and forbidding colons doesn't seem like the craziest restrictions on file names. It can definitely get out of hand, though, if you start excluding too much stuff. IIRC, Azure doesn't even allow slashes in storage account names which greatly limits naming schemes and goes too far in my opinion.
- hn92726819 3y agoThanks for the correction! It seems more complicated after looking more into it. According to https://en.m.wikipedia.org/wiki/Filename https://en.m.wikipedia.org/wiki/Filename , reserved characters are: HFS: > : HFS+: > : on disk, in classic Mac OS, and at the Carbon layer in macOS; / at the Unix layer in macOS APFS: > In the Finder, filenames containing / can be created, but / is stored as a colon (:) in the filesystem, and is shown as such on the command line. Filenames containing : created from the command line are shown with / instead of : in the Finder, so that it is impossible to create a file that the Finder shows as having a : in its filename. TIL about a 'carbon layer' and 'POSIX layer'