• 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: Normalising file names on macOS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Normalising file names on macOS


  • Subject: Re: Normalising file names on macOS
  • From: Alastair Houghton <email@hidden>
  • Date: Thu, 22 Sep 2016 17:19:55 +0100

On 22 Sep 2016, at 16:30, Ken Thomases <email@hidden> wrote:
>
> Without undermining Alastair's recommendations, you can achieve what you want by round-tripping the string through -[NSString fileSystemRepresentation] and -[NSFileManager stringWithFileSystemRepresentation:length:].  That handles the normalization, but it doesn't do anything about characters that aren't legal in file names on a given file system.

:-)  I pondered mentioning -fileSystemRepresentation but decided it didn’t really solve the problem.  Right now, you’re right, it does normalise strings, but that isn’t documented and it’s probably undesirable - the HFS implementation can already cope with precomposed characters and by decomposing before passing to the BSD APIs there’s a risk that the present implementation will prevent a Cocoa program from opening the correct file (or any file at all) on some filesystems.

(It also has no way to know what filesystem’s rules it’s supposed to use, so it isn’t as if Apple could selectively disable normalisation to resolve this problem.)

Kind regards,

Alastair.

--
http://alastairs-place.net


_______________________________________________

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


References: 
 >Normalising file names on macOS (From: John Brownie <email@hidden>)
 >Re: Normalising file names on macOS (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: How to update UI from a background thread
  • Next by Date: Re: Maximum image size ?
  • Previous by thread: Re: Normalising file names on macOS
  • Next by thread: Re: Normalising file names on macOS
  • Index(es):
    • Date
    • Thread