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 protected])

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