Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString pedantic question



Look at -[NSFileManager stringWithFileSystemRepresentation:length:].
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFileManager/stringWithFileSystemRepresentation:length: >


Aki

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSString pedantic question (From: John Stiles <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.