Re: Case sensitive fileName
Re: Case sensitive fileName
- Subject: Re: Case sensitive fileName
- From: Aaron Burghardt <email@hidden>
- Date: Wed, 17 Mar 2010 15:54:54 -0400
On Mar 17, 2010, at 3:24 PM, gMail.com wrote:
> Thank you! I have used realpath, and it worked as like a charm!
> Here's my code. One question only: is the NSUTF8StringEncoding correct?
>
> - (NSString*)CaseSensitiveFilePath:(NSString*)filePath
> {
> const char *cFilePath = [mManager
> fileSystemRepresentationWithPath:filePath];
> if(cFilePath == 0 || *cFilePath == L'\0') return filePath;
>
> int len = PATH_MAX + 1;
> char cRealPath[len];
> memset(cRealPath, 0, len);
> char *result = realpath(cFilePath, cRealPath);
>
> //printf("CaseSensitiveFileName %s\n", result);
> if(result != NULL) return [NSString stringWithCString:result
> encoding:NSUTF8StringEncoding];
> else return filePath;
> }
Yes. But, you should return:
[mManager stringWithFileSystemRepresentation:result length:strlen(result)];
There are other potential transformations that the "file system representation" methods perform.
Aaron
_______________________________________________
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