Re: NSString pedantic question
Re: NSString pedantic question
- Subject: Re: NSString pedantic question
- From: Ryan Britton <email@hidden>
- Date: Wed, 28 Mar 2007 16:57:07 -0700
The reverse is hiding in NSFileManager. Not exactly obvious.
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Classes/NSFileManager_Class/Reference/Reference.html#//apple_ref/occ/
instm/NSFileManager/stringWithFileSystemRepresentation:length:
On Mar 28, 2007, at 4:53 PM, John Stiles wrote:
I am writing code that deals with NSStrings and paths.
I know that, to turn an NSString into a proper path, the best API
to use is [myString fileSystemRepresentation]. You can also use
[myString UTF8String] and it seems to work fine, but everyone says
that the best, future-proof method is -fileSystemRepresentation, so
we use it without question.
But what about going in reverse—if you've got a file system
representation in a char array, there doesn't seem to be a
[NSString stringWithFileSystemRepresentation:myCharPtr] API to load
it back into an NSString. I've been using [NSString
stringWithUTF8String:myCharPtr], which works fine, but it doesn't
feel all nice and symmetric like it should. If that hypothetical
future came to pass where the file system representation was no
longer UTF8, I'd have to revamp this code. I don't expect that this
will ever be an issue in practice, but I still feel like I'm
missing something.
Any thoughts?_______________________________________________
Cocoa-dev mailing list (email@hidden)
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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