• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fileExistsAtPath:isDirectory - BROKEN?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileExistsAtPath:isDirectory - BROKEN?


  • Subject: Re: fileExistsAtPath:isDirectory - BROKEN?
  • From: Tom Harrington <email@hidden>
  • Date: Wed, 2 Nov 2005 14:11:50 -0700

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

  • Follow-Ups:
    • Re: fileExistsAtPath:isDirectory - BROKEN?
      • From: Bruce Truax <email@hidden>
References: 
 >fileExistsAtPath:isDirectory - BROKEN? (From: Bruce Truax <email@hidden>)

  • Prev by Date: -refreshObject:mergeChanges: - need more transient property flexibility
  • Next by Date: Margin Size Inconsistencies FYI
  • Previous by thread: fileExistsAtPath:isDirectory - BROKEN?
  • Next by thread: Re: fileExistsAtPath:isDirectory - BROKEN?
  • Index(es):
    • Date
    • Thread