Re: fileExistsAtPath:isDirectory - BROKEN?
Re: fileExistsAtPath:isDirectory - BROKEN?
- Subject: Re: fileExistsAtPath:isDirectory - BROKEN?
- From: Bruce Truax <email@hidden>
- Date: Wed, 02 Nov 2005 16:26:09 -0500
- Thread-topic: fileExistsAtPath:isDirectory - BROKEN?
Tom,
I am not sure what was going on. I left the computer and then came back,
ran step by step through the code with the debugger and this time everything
was fine. Sorry for the confusion.
Bruce
On 11/2/05 4:11 PM, "Tom Harrington" <email@hidden> wrote:
> On 11/2/05, Bruce Truax <email@hidden> wrote:
>> I am having trouble with fileExistsAtPath:isDirectory. I have been using
>> this for some time and today, after upgrading to 10.4.3 it appears to be
>> broken. The isDirectory flag does not appear to be set properly. Here is
>> my code snippet:
>
> I can't reproduce the problem. I used your code, only adding
> declarations of isDir (as a BOOL) and aliasPath (as an NSString *),
> and initializing isDir to NO.
>
>> NSFileManager *fileManager = [NSFileManager defaultManager];
>> aliasPath = [[NSString alloc] initWithFormat:@"~/Library/AccosLnks"];
>> NSLog(@"isDir %i", isDir);
>> [fileManager fileExistsAtPath:[aliasPath stringByExpandingTildeInPath]
>> isDirectory:&isDir];
>
> I also added an additional NSLog() here:
>
> NSLog(@"isDir %i", isDir);
>
>> if (!([fileManager fileExistsAtPath:[aliasPath
>> stringByExpandingTildeInPath] isDirectory:&isDir] && isDir)){
>> [fileManager createDirectoryAtPath:[aliasPath
>> stringByExpandingTildeInPath]
>> attributes:nil];
>> NSLog(@"isDir %i", isDir);
>> [aliasPath release];
>> }
>
> If the directory does not exist, I get:
>
> 2005-11-02 14:02:50.718 a.out[1508] isDir 0
> 2005-11-02 14:02:50.722 a.out[1508] isDir 0
> 2005-11-02 14:02:50.724 a.out[1508] isDir 0
>
> Not surprising it's always 0, there's no code to change isDir after
> creating the dir.
>
> If the directory does exist, I get:
>
> 2005-11-02 14:02:58.374 a.out[1509] isDir 0
> 2005-11-02 14:02:58.378 a.out[1509] isDir 1
>
> ...which is what I'd expect.
>
> It doesn't look broken from here. What do you get if you add the extra
> NSLog()?
>
> --
> Tom Harrington
> email@hidden
> AIM: atomicbird1
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
____________________________________________________________
Bruce E. Truax email: email@hidden
Optical Engineering Consultant
Diffraction Limited Design LLC
388 Wedgewood Road voice: 860-276-0450
Southington, CT 06489 fax: 860-620-9026
http://www.dld-llc.com
_____________________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden