Re: Case sensitive fileName

2010-03-29 Thread gMail.com
. -- Leonardo Da: Jens Alfke j...@mooseyard.com Data: Wed, 17 Mar 2010 09:07:26 -0700 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: Case sensitive fileName On Mar 17, 2010, at 6:35 AM, gMail.com wrote: Now I need to get its real case sensitive file

Re: Case sensitive fileName

2010-03-29 Thread Jens Alfke
On Mar 29, 2010, at 6:24 AM, gMail.com wrote: I have finally realized that the API realpath traverses the sym links. And I need to not to traverse them. Any other idea? Thanks. This is turning into a filesystem API question … you might get more ideas if you post on the darwin-userlevel

Case sensitive fileName

2010-03-17 Thread gMail.com
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. I know I can

Re: Case sensitive fileName

2010-03-17 Thread gMail.com
Mar 2010 14:41:05 + 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

Re: Case sensitive fileName

2010-03-17 Thread Jens Alfke
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

Re: Case sensitive fileName

2010-03-17 Thread Don Quixote de la Mancha
Does readdir work on Mac OS X? I don't have a Mac handy right now to check, but it should work because so many *NIX programs build on OS X right out of the box. More or less what you do is call opendir on a directory, then rewinddir to set your iterator to the beginning of the directory, then

Re: Case sensitive fileName

2010-03-17 Thread Michael Davey
I don't think that the OP wanted to iterate through the entire directory though... On 17 Mar 2010, at 16:15, Don Quixote de la Mancha wrote: Does readdir work on Mac OS X? I don't have a Mac handy right now to check, but it should work because so many *NIX programs build on OS X right out

Re: Case sensitive fileName

2010-03-17 Thread Don Quixote de la Mancha
I don't think that the OP wanted to iterate through the entire directory though... Maybe so, but I don't think there would be any real disadvantage to doing so. I'm pretty sure that just about any API that can retrieve a filename from a directory will iterate through the whole directory

Re: Case sensitive fileName

2010-03-17 Thread Kevin Wojniak
: Jeremy Pereira jeremyp...@me.com Data: Wed, 17 Mar 2010 14:41:05 + 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

Re: Case sensitive fileName

2010-03-17 Thread Aaron Burghardt
Jens gets the prize: $ cat realpath_test.c #include stdio.h #include sys/param.h #include stdlib.h int main(int argc, char *argv[]) { char resolved_name[PATH_MAX]; realpath(argv[1], resolved_name); printf(%s\n, resolved_name); } $ gcc realpath_test.c -o realpath_test

Re: Case sensitive fileName

2010-03-17 Thread Jens Alfke
On Mar 17, 2010, at 9:28 AM, Don Quixote de la Mancha wrote: I don't think that the OP wanted to iterate through the entire directory though... Maybe so, but I don't think there would be any real disadvantage to doing so. Performance. I'm pretty sure that just about any API that can

Re: Case sensitive fileName

2010-03-17 Thread Andreas Mayer
Am 17.03.2010 um 17:46 Uhr schrieb Kevin Wojniak: NSLog(@displayNameAtPath: %@, [[NSFileManager defaultManager] displayNameAtPath:path]); Note that -displayNameAtPath: will give you the localized name if one should exist. (For example you'll get 'Programme' for the 'Applications' folder

Re: Case sensitive fileName

2010-03-17 Thread Don Quixote de la Mancha
On Wed, Mar 17, 2010 at 10:23 AM, Jens Alfke j...@mooseyard.com wrote:  I'm pretty sure that just about any API that can retrieve a filename from a directory will iterate through the whole directory anyway. No; retrieving a file by name is just a B+tree lookup in HFS. Walking through the

Re: Case sensitive fileName

2010-03-17 Thread Jeremy Pereira
On 17 Mar 2010, at 13:35, gMail.com wrote: 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

Re: Case sensitive fileName

2010-03-17 Thread Jeremy Pereira
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

Re: Case sensitive fileName

2010-03-17 Thread gMail.com
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

Re: Case sensitive fileName

2010-03-17 Thread Aaron Burghardt
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

Re: Case sensitive fileName

2010-03-17 Thread Ken Thomases
On Mar 17, 2010, at 12:35 PM, Andreas Mayer wrote: Am 17.03.2010 um 17:46 Uhr schrieb Kevin Wojniak: NSLog(@displayNameAtPath: %@, [[NSFileManager defaultManager] displayNameAtPath:path]); Note that -displayNameAtPath: will give you the localized name if one should exist. (For