• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Renaming files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming files?


  • Subject: Re: Renaming files?
  • From: Brendan Younger <email@hidden>
  • Date: Mon, 20 Dec 2004 16:29:14 -0600


On Dec 20, 2004, at 4:11 PM, Jeremy Dronfield wrote:


On 20 Dec 2004, at 5:01 pm, Christoffer Lerno wrote:

I thought I had renaming files nailed down by using NSFileManager's movePath:toPath:handler: but it has problems with spaces & non ascii characters in filenames - the documentation unfortunately doesn't reveal how this is circumvented.

In my experience, the only character -movePath:toPath:handler: can't cope with is a "/". It's possible, using the Finder, to put a slash in a filename, and NSFileManager interprets it as a path separator. (There may even be a way round this, but I haven't looked. I know Carbon can cope with it.)

The path separator on HFS(+) is ":", so trying to place a ":" in a name in the Finder will fail; whereas, if you're using POSIX or Cocoa APIs, you can place a ":" in the name with impunity. This is because, on an HFS(+) volume, the POSIX APIs translate all occurrences of "/" in a node name to ":" and vice-versa for Carbon calls on non-HFS(+) volumes. [1] Essentially, the level of API you're using determines whether ":" or "/" is a path separator or just a regular character. (Curse in-band delimiters!)


Brendan Younger

[1] It should be noted that full paths in Carbon file manager functions are really quite rare, so this isn't nearly so much of a headache on the Carbon side.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Renaming files? (From: Christoffer Lerno <email@hidden>)
 >Re: Renaming files? (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: Current tick mark index of NSSlider?
  • Next by Date: Re: Toolbar bug?
  • Previous by thread: Re: Renaming files?
  • Next by thread: Re: Renaming files?
  • Index(es):
    • Date
    • Thread