Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Name files with a slash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Name files with a slash
Authored by: cram on Dec 28, '03 07:18:50AM

It has always been here, and it is (I think) a conversion done in the Finder : a "/" in a filename is converted in a ":" in the Unix filename (as you can see with Terminal.

On the other hand, some Carbon programs use ":" in the path (like under Classic Mac OS), which are converted to "/" by the system.



[ Reply to This | # ]
10.3: Name files with a slash
Authored by: Tom Robinson on Dec 29, '03 02:13:36AM
A good explanation is from the paper 'The Challenges of Integrating the Unix and Mac OS Environments' which is still available at http://www.mit.edu/people/wsanchez/papers/USENIX_2000/, as follows:
Another obvious problem is the different path separators between HFS+ (colon, ':') and UFS (slash, '/'). This also means that HFS+ file names may contain the slash character and not colons, while the opposite is true for UFS file names. This was easy to address, though it involves transforming strings back and forth. The HFS+ implementation in the kernel's VFS layer converts colon to slash and vice versa when reading from and writing to the on-disk format. So on disk, the separator is a colon, but at the VFS layer (and therefore anything above it and the kernel, such as libc) it's a slash. However, the traditional Mac OS toolkits expect colons, so above the BSD layer, the core Carbon toolkit does yet another translation. The result is that Carbon applications see colons, and everyone else sees slashes. This can create a user-visible schizophrenia in the rare cases of file names containing colon characters, which appear to Carbon applications as slash characters, but to BSD programs and Cocoa applications as colons.
There do seem to be a number of inconsistent applications though. For instance, it was only in AppleScript 1.9.2 (shipped with 10.3) where:
The open for access command can now create a file whose name contains slashes or colons (whichever is not the native path separator for the path style in use). [3267270]
Cheers

[ Reply to This | # ]