Skip navigation.
 
mlRe: Rename files containing a slash
FROM : Howard Oakley
DATE : Mon Oct 21 20:30:34 2002

On 21/10/02 19:19, Lorenzo Puleo wrote:

> I'm trying to rename a file using a new filename containing a slash.
> Since I can't find a Cocoa API that renames files I use the Carbon API:
> err = FSRenameUnicode(&destRef, nameLength, name, theInfo.textEncodingHint,
> nil);
>
> Each time the fileName proposed contains a slash (that Finder accepts) this
> API returns an error. Please may someone help me to fix the trouble?
> Thank you.


Lorenzo,

The error is that you cannot and must not put a slash in a filename in OS X.
(Yes, I know that some things in the past have done so, but this has from
the Public Beta been a bad move.)

This is because the slash is the BSD separator in paths. OS X is unable to
distinguish between a file called this/that and a file called that in the
folder this.

The same applies to OS X's other separator (from its Mac heritage), the
colon - it also causes confusion in paths.

If you want to verify this, try editing a file name in the Finder (in Jaguar
or later - 10.0 and 10.1 did not object so strongly!) to contain these
characters.

One other character to avoid is a trailing hash # followed by anything that
could appear to be hexadecimal, e.g. this#dead - this is a bug affecting
10.2 and 10.2.1, though, and not intentional.

Howard.

Dr Howard Oakley            * <email_removed>
EHN & DIJ Oakley            * <email_removed>
Brooklands Lodge            * GPRS email <email_removed>
Park View Close            * mobile (& SMS) +44 7811 326837
Wroxall, Ventnor            * home voice +44 1983 853605
Isle of Wight, PO38 3EQ, UK * http://www.quercus.demon.co.uk
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlRename files containing a slash Lorenzo Puleo Oct 21, 20:19
mlRe: Rename files containing a slash Howard Oakley Oct 21, 20:30
mlRe: Rename files containing a slash Ondra Cada Oct 21, 20:38
mlRe: Rename files containing a slash Ondra Cada Oct 21, 20:39
mlRE: Rename files containing a slash Josh Ferguson Oct 21, 20:39
mlRe: Rename files containing a slash Finlay Dobbie Oct 21, 20:47
mlRe: Rename files containing a slash Ondra Cada Oct 21, 22:27
mlRe: Rename files containing a slash Howard Oakley Oct 21, 22:30
mlRe: Rename files containing a slash Ondra Cada Oct 22, 00:03
mlRe: Rename files containing a slash Pierre-Olivier Lat… Oct 22, 00:15
mlRe: Rename files containing a slash Rosyna Oct 22, 00:34
mlRe: Rename files containing a slash Rosyna Oct 22, 00:41
mlRe: Rename files containing a slash Charles Srstka Oct 22, 04:40
mlRe: Rename files containing a slash Lorenzo Puleo Oct 22, 10:11