On Nov 27, 2008, at 1:09 AM, Knut Lorenzen wrote:

Dear list,

I would like to name a file according to an user defined entry. However, the user's name entry might be illegal as a filepath, containing illegal characters for a pathname like "." or "-" as 1st character, "/", ":", etc.

I've looked into the Cocoa docs for NSString and NSFileManager to no avail.

Is there a recommended way to "clean" an NSString in order to get a valid filepath? One could simply replace all suspicious characters with an underscore (or something else), but that is not very elegant and feels like fighting the framework.

Cheers,

Knut

        try using -[NSString fileSystemRepresentation]

------
What is a woman that you forsake her, and the hearth fire and the home acre, to go with the old grey Widow Maker. --Kipling, harp song of the Dane women
Tommy Nordgren
[EMAIL PROTECTED]



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to