Re: Why is NSString->FSRef so hard?
Re: Why is NSString->FSRef so hard?
- Subject: Re: Why is NSString->FSRef so hard?
- From: Uli Kusterer <email@hidden>
- Date: Fri, 1 May 2009 14:13:24 +0200
On 29.04.2009, at 15:15, Mark Douma wrote:
If you are working with file paths, you shouldn't be using
componentsSeparatedByString:, nor should you be defining "/" to be
the component you should be separating by. What if someone had your
app inside of a folder they named "Apps/Utilities"? The HFS+
filesystem actually uses a colon as the path separator, so having
a / in the name of a file or folder is perfectly acceptable, but
would likely cause a headache and unexpected results if your code
were to encounter it. (Go to the Finder and try adding a /).
Errr... No.
This is very misleading. While it is true that HFS and HFS+ use a
colon as the path separator on disk, all Cocoa and POSIX APIs on the
Mac swap colons and slashes before you ever get to see them. The only
case where you as a programmer see this difference is in Finder, in
CoreServices File Manager calls (fka Carbon File Manager), and when
you call displayNameAtPath:.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden