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

Re: Case sensitive fileName

2010-03-29 Thread gMail.com
ld traverse SymLinks. -- Leonardo > Da: Jens Alfke > Data: Wed, 17 Mar 2010 09:07:26 -0700 > A: "gMail.com" > Cc: > Oggetto: Re: Case sensitive fileName > > > On Mar 17, 2010, at 6:35 AM, gMail.com wrote: > >> Now I need to get its real case sensi

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. >

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 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 fileSystemRepresentationWithPath

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. >

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

Re: Case sensitive fileName

2010-03-17 Thread Don Quixote de la Mancha
On Wed, Mar 17, 2010 at 10:23 AM, Jens Alfke 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 directory is

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' folde

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 ret

Re: Case sensitive fileName

2010-03-17 Thread Aaron Burghardt
Jens gets the prize: $ cat realpath_test.c #include #include #include 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 $ ./realpath_test REALP

Re: Case sensitive fileName

2010-03-17 Thread Kevin Wojniak
ike PBGetCatInfo using the ioFRefNum... > Any idea? > > Regards > -- > Leonardo > >> Da: Jeremy Pereira >> Data: Wed, 17 Mar 2010 14:41:05 +0000 >> A: "gMail.com" , Apple Cocoa Develop Develop >> >> Cc: Jeremy Pereira >> Oggett

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 anyw

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
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 rep

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], o

Re: Case sensitive fileName

2010-03-17 Thread gMail.com
2010 14:41:05 + > A: "gMail.com" , Apple Cocoa Develop Develop > > Cc: Jeremy Pereira > Oggetto: Re: Case sensitive fileName > > NSURL* url = [NSURL fileURLWithPath: path]; > NSError* error = nil; > NSArray* keysIWant = [NSArray arrayWithObject: NS

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 ite