• 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: NSString, path and "/" char
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString, path and "/" char


  • Subject: Re: NSString, path and "/" char
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 24 Nov 2006 12:29:12 -0500
  • Organization: Rogue Research

On 2006-11-24 07:56, Clark Cox said:

>Filenames on MacOSX cannot contain '/', period.

I guess that depends on how you define 'filename'.  :)  Certainly from
the end user's definition of 'filename' your statement is wrong.  Both
the Finder and NSSavePanel forbid ':' and allow '/'.  And if I put an HFS
+ disk in an OS 9 machine I can create a file who's name has a '/'.  If
I then move the disk to on OS X machine... then what?  The filename is
still the same, isn't it?

>Any time the
>Finder/file selection dialog shows a file with '/' in the name, that
>is actually a ':' in the filename.

How the name is represented on disk depends on the file system.  I'm not
a file systems expert, but I'm pretty sure that, strictly speaking, HFS+
allows any Unicode character in a filename and that HFS+ doesn't store
paths anywhere, and thus there is no concept of a path separator (at
that level).

But this is all besides the point...

>So, if the user wants you to put a '/' in a filename, simply replace
>it with a ':'. If the user wants a ':' in the filename, either don't
>allow it, or pass it through unchanged (in which case the user will
>see a ':' if they look at the file in the Terminal, and a '/' if they
>look at the file in the GUI).

What about non-HFS+?  Some file systems allow neither : nor / in filenames.

Trygve, I believe the only way to know if a filename is any good is to
try creating a file with that name.  I'm also pretty sure I remember a
very similar discussion in the past, probably on carbon-dev, you might
want it check its archives.

Of course, this is part of the point of NSSavePanel.  You let it worry
about getting an acceptable name from the user, and then proceed with
confidence.  For example, the mere typing of a ':' is hijacked and
becomes a '-'.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

  • Follow-Ups:
    • Re: NSString, path and "/" char
      • From: Rosyna <email@hidden>
    • Re: NSString, path and "/" char
      • From: glenn andreas <email@hidden>
References: 
 >NSString, path and "/" char (From: Trygve Inda <email@hidden>)
 >Re: NSString, path and "/" char (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: New WebView
  • Next by Date: Re: NSString, path and "/" char
  • Previous by thread: Re: Re: NSString, path and "/" char
  • Next by thread: Re: NSString, path and "/" char
  • Index(es):
    • Date
    • Thread