Re: Case sensitive fileName
Re: Case sensitive fileName
- Subject: Re: Case sensitive fileName
- From: Jeremy Pereira <email@hidden>
- Date: Wed, 17 Mar 2010 16:22:14 +0000
On 17 Mar 2010, at 16:07, Jens Alfke wrote:
>
> On Mar 17, 2010, at 6:35 AM, gMail.com wrote:
>
>> 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.
>
> Have you tried -[NSString stringByStandardizingPath], or the BSD function realpath()? The docs don’t explicitly say they correct case, but it seems like the kind of thing they would do.
The code:
const char* path = "/etc/HOSTS";
char realPath[PATH_MAX + 1];
memset(realPath, 0, PATH_MAX + 1);
printf("%s\n", realpath(path, realPath));
gives output /private/etc/hosts
so, depending on the application, it might be working too well as it resolves symlinks.
>
> —Jens_______________________________________________
>
> 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
_______________________________________________
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