Hello everyone,

Forgive me if this has already been answered, but my searches through the archive didn't turn up anything.

The situation is that I need to allow users to rename files within my application. The name of the file is displayed in an NSTableView, and the delegate method "tableView:setObjectValue:etc" triggers the underlying file to be renamed.

A problem arises when a file contains special/reserved characters, eg: the dreaded backslash/colon. There's the handy -[NSFileManager displayNameAtPath:] which seems to convert colons in paths to backslashes for display, but no inverse. How am I to convert whatever name the user has entered to a form suitable for use with "stringByAppendingPathComponent:"?

Likewise, what about validation? I don't believe a user can use a colon ":" on an HFS file system (at least my Finder doesn't allow it). I would expect a method on NSFileManager like "pathNameForDisplayName:" that returns nil if the name is illegal on the underlying file system. I hate to hardcode any of these characters.

Thanks for any help,

~Martin

_______________________________________________

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 arch...@mail-archive.com

Reply via email to