Re: A mystery with NSFileManager
Re: A mystery with NSFileManager
- Subject: Re: A mystery with NSFileManager
- From: David Remahl <email@hidden>
- Date: Sun, 24 Feb 2002 00:43:56 +0100
>
The following lines:
>
>
NSFileManager *fm = [NSFileManager defaultManager];
>
BOOL isDirectory;
>
>
NSLog(@"%@", [fm fileExistsAtPath:@"/tmp" isDirectory:&isDirectory] ?
>
@"YES" : @"NO");
>
NSLog(@"%@", isDirectory ? @"YES" : @"NO");
>
>
produce the output:
>
>
YES
>
NO
>
>
In other words, the -fileExistsAtPath:isDirectory: call returns
>
success, but the isDirectory flag is set to NO -- it claims /tmp is not
>
a directory. Now, there's nothing wrong with /tmp on my machine; it's
>
sitting right there, it conatins some spam files I've made over the past
>
days, I have rwx access to it.
>
Is this a (bizarre) bug in NSFileManager, or am I missing something?
>
Using @"/tmp/" returns YES for isDirectory, so it sure looks like a bug
>
to me. Unfortunately, @"/tmp" is the form of the path returned by
>
NSOpenPanel...
>
Anybody have any comments? I don't know much about the Unix file
>
system, maybe this is just ignorance on my part. Thanks!
>
>
Ben Haller
>
Stick Software
My guess is that the reason that /tmp returns NO, is that /tmp is really a
symlink to private/tmp. If you don't append the trailing /, then it is
treated as pointing to the actual 10bytes large link, not the directory it
represents....
I believe there are methods for resolving symlinks, and checking wether they
are symlinks...
/ david
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.