Re: renaming a file with special/reserved characters in name
Re: renaming a file with special/reserved characters in name
- Subject: Re: renaming a file with special/reserved characters in name
- From: Mike Abdullah <email@hidden>
- Date: Thu, 26 Feb 2009 12:39:18 +0000
On 26 Feb 2009, at 07:29, Martin Wierschin wrote:
Hi Michael,
I appreciate your reply, thank you.
The first is the slash (/). Note, NOT a backslash (\), that one is
fine. Slash is the path separator and thus can't exist in a filename.
Whoops, quite right, my mistake.
Except it doesn't, because each filesystem is different. The above is
true for HFS+, it is NOT true for FAT32, which has a whole bunch of
other characters which are illegal.
This is the bad news: there is NO way to tell what those characters
are.
It seems totally crazy that there isn't an API for this, Cocoa or
not. Oh well, obviously one must code to handle a failure in the
rename operation, so this actually simplifies my task. I still have
to hardcode the magic conversion of slashes to colons- a shame.
I suppose you could argue that there is sort of an API, trying to use
the filename and see if it fails. I think the main point is that the
way some file systems work means you can't determine failure without
trying first. Plus, presumably users may then either choose to change
the filename or save it elsewhere.
_______________________________________________
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