• 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: Path comparison and case sensitivity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path comparison and case sensitivity


  • Subject: Re: Path comparison and case sensitivity
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 5 Jan 2010 23:39:52 -0600

On Jan 5, 2010, at 6:51 PM, Rob Keniger wrote:

> Should Cocoa applications always assume that the filesystem is case-insensitive when comparing path strings? Surely this could lead to problems if the user has formatted a volume with a case-sensitive file system?

Don't compare paths.  Use APIs like FSCompareFSRefs() or call -[NSFileManager attributesOfItemAtPath:error:] and compare the NSFileDeviceIdentifier and NSFileSystemFileNumber keys (this is the Cocoa equivalent of calling stat(2) and comparing st_dev and st_ino).

> Is there any way to know whether or not a file is on a case-sensitive volume?

A couple of ways (there are others):

On 10.6 and later, see NSURL's new resource-values APIs and NSURLVolumeSupportsCaseSensitiveNamesKey.

On 10.3 and later, see getattrlist and VOL_CAP_FMT_CASE_SENSITIVE.

Regards,
Ken

_______________________________________________

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

  • Follow-Ups:
    • Re: Path comparison and case sensitivity
      • From: Alastair Houghton <email@hidden>
    • Re: Path comparison and case sensitivity
      • From: Rob Keniger <email@hidden>
References: 
 >Path comparison and case sensitivity (From: Rob Keniger <email@hidden>)

  • Prev by Date: Re: main document window disappears when resizing
  • Next by Date: Re: NSRecursiveLock problems
  • Previous by thread: Path comparison and case sensitivity
  • Next by thread: Re: Path comparison and case sensitivity
  • Index(es):
    • Date
    • Thread