On 26 Nov 2008, at 15:28, Jean-Daniel Dupas wrote:

Le 26 nov. 08 à 16:19, James Montgomerie a écrit :

On 26 Nov 2008, at 14:56, Nick Rogers wrote:
Hi,
How do I obtain a NSFileHandle to this file which has a forward slash in the name to be able to write to this file. Supplying the path to NSFileHandle with filename in quotes also fails.
If not possible is there any other way to write to such a file.
I can't use open(), as the file name could contain chars from other language.


This file is only presented as having a '/' in the Finder UI (and hopefully other places that present filenames on-screen). At the filesystem level, that '/' is really a ':' (to avoid clashing with the '/' directory seperator character). Just replace the '/' with a ':' and you'll be set.


In fact, this is the contrary. It is presented as having a colon at the UNIX level, but really have a slash at the FS level.

http://www.macgeekery.com/gspot/2006-09/when_a_colons_a_slash_and_a_slashs_a_colon

True (on HFS and HFS-derived systems). I'd call that more of an implementation detail though - It's not as if the filenames are stored on disk as UTF-8 strings either, but I'd still way that 'at the filesystem level', from an API-user's perspective, that's true.

Anyway, for someone who just wants to open a file, this is a bit academic. The API's require UTF-8, and accept ':' characters, but not '/' characters. '/' characters displayed in the Finder must be translated to ':' characters for interaction with the filesystem APIs, and vice-versa.

Jamie._______________________________________________

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