These two methods worked for me: NSString *path = @"/FOLDER/FILENAME.txt";
NSLog(@"displayNameAtPath: %@", [[NSFileManager defaultManager] displayNameAtPath:path]); FSRef ref; HFSUniStr255 name255; if (!FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &ref, NULL) && !FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, &name255, NULL, NULL)) { CFStringRef name = CFStringCreateWithCharacters(NULL, name255.unicode, name255.length); if (name) { NSLog(@"FSGetCatalogInfo: %@", (NSString *)name); CFRelease(name); } } On Mar 17, 2010, at 8:54 AM, gMail.com wrote: > Thanks, that's fine for 10.6, but I have to compile against 10.5... > I guess there should be a quick way with some C command, or Unix command or > even with the Carbon APIs, like PBGetCatInfo using the ioFRefNum... > Any idea? > > Regards > -- > Leonardo > >> Da: Jeremy Pereira <jeremyp...@me.com> >> Data: Wed, 17 Mar 2010 14:41:05 +0000 >> A: "gMail.com" <mac.iphone....@gmail.com>, Apple Cocoa Develop Develop >> <cocoa-dev@lists.apple.com> >> Cc: Jeremy Pereira <jeremyp...@me.com> >> Oggetto: Re: Case sensitive fileName >> >> NSURL* url = [NSURL fileURLWithPath: path]; >> NSError* error = nil; >> NSArray* keysIWant = [NSArray arrayWithObject: NSURLNameKey]; >> NSDictionary* resources = [url resourceValuesForKeys: keysIWant error: >> &error]; >> if (resources != nil) >> { >> NSString* actualPath = [resources objectForKey: NSURLNameKey]; >> NSLog(@"%@", actualPath); >> } > >>> Hi, I have a file path >>> /Folder/filename.txt >>> The API fileExistsAtPath says that it exists. >>> Now I need to get its real case sensitive file name, which is indeed e.g. >>> "FileName.txt" >>> How can I get it in a fast way? I thought by its inode, but I can't really >>> know how to do that. > > > _______________________________________________ > > 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/kainjow%40kainjow.com > > This email sent to kain...@kainjow.com _______________________________________________ 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 arch...@mail-archive.com