Re: NSFileManager - "Can't read directory contents" ??
Re: NSFileManager - "Can't read directory contents" ??
- Subject: Re: NSFileManager - "Can't read directory contents" ??
- From: Shon <email@hidden>
- Date: Tue, 19 Jul 2005 13:39:19 -0400
I didn't copy/paste that path; it is indeed "/Volumes/SHONSD". I don't key
this path in, it comes from the notification. The destination path is
"./temp/" and is currently hard-coded into the app.
By "getting the directory contents myself", I do mean through
NSFileManager, in the same code that handles the error. Just before and
after copyPath, I had inserted calls to get the directory contents and dump
the list. I removed them some time before posting.
I'll give stringByStandardizingPath a try and reply again. I'm beginning to
think the 'wrongness' is with "./temp/", but the error just doesn't mention
it.
Thanks for the tips ... and your patience.
--S
On 7/19/05, SA Dev <email@hidden> wrote:
>
>
> Would you mind sharing both paths? A second pair of eyes can only
> help. I notice you said, "The second key/value pair is "Path"="/
> Volume/SHONSD" -- if you didn't type that in manually (you copied and
> pasted), the path is definitely wrong ... should be "/Volumes/...".
>
> When you said you can read the directory contents yourself, do you
> mean with NSFileManager or by using the Finder? If the latter, that's
> really irrelevant. If the former, then I *strongly* suspect there's
> still some path 'wrongness' somewhere.
>
> Perhaps if you NSLog() out the paths just prior to actually using
> them, then post the results here, something might pop out. It's also
> helpful to make sure you're standardizing the paths (-
> stringByStandardizingPath) before use. This will expand tildes, etc.
>
>
>
>
>
> On Jul 19, 2005, at 11:20 AM, Shon wrote:
>
> > Geez - guess I forgot to say this: It never copies any files. It
> > fails on the copyPath call.
> >
> > Yes, I've verified all the paths via debugging.
> >
> > --S
> >
> >
> > On 7/19/05, SA Dev <email@hidden> wrote:
> > Okay, but you're asking NSFileManager to do stuff in two different
> > places. Where does it fail? Have you used the debugger to step
> > through and look at the values you're passing? Have you logged out
> > the paths just prior to using them to make sure they're properly
> > constructed?
> >
> > You really need to provide more details than this.
> >
> >
> >
> > On Jul 19, 2005, at 11:03 AM, Shon wrote:
> >
> > > When I dump errorInfo in the {fileManager:manager
> > > shouldProceedAfterError:errorInfo} delegate/callback, "Error" is
> > > set to "Can't read directory contents", that's why I used the
> > > quotes in the subject. The second key/value pair is "Path"="/
> > > Volume/SHONSD"
> > >
> > > Is there someplace else I can look for more diagnostic error
> > > information?
> > >
> > > --S
> > >
> > >
> > > On 7/19/05, SA Dev <email@hidden> wrote: Shon:
> > >
> > > If you want help, I suggest posting the *actual error* you are
> > > receiving. Our collective crystal ball is in the shop today ... :-)
> > >
> > >
> > >
> > > On Jul 18, 2005, at 9:01 PM, Shon wrote:
> > >
> > > > I NSFileManager gives me this error, but I can read the directory
> > > > just fine.
> > > >
> > > > I register for NSWorkspaceDidMountNotification:
> > > >
> > > > NSNotificationCenter *notCenter;
> > > > SEL SELunmount;
> > > >
> > > > notCenter = [[NSWorkspace sharedWorkspace]
> > > > notificationCenter];
> > > > SELmount = @selector(VolumeMounted:);
> > > >
> > > > [notCenter addObserver:self selector:SELmount
> > > > name:@"NSWorkspaceDidMountNotification" object:nil];
> > > >
> > > > When the notification comes in, I attempt a copy:
> > > > - (void)VolumeMounted: (NSNotification *)notification
> > > > {
> > > > //Where did you say you put that volume?
> > > > NSString *path = [[notification userInfo]
> > > > valueForKey:@"NSDevicePath"];
> > > > NSString *destination = @"./temp/"; //Let's copy it to
> > > > here...
> > > >
> > > > NSFileManager *fm = [NSFileManager defaultManager];
> > > > [fm createDirectoryAtPath:destination attributes:nil]; //
> > > > create the
> > > > destination
> > > >
> > > > if ([fm copyPath:path toPath:destination handler:self])
> > > > [currentOperationField setStringValue:@"Copy
> > > complete!"];
> > > > else
> > > > [currentOperationField setStringValue:@"Error while
> > > > copying"];
> > > > }
> > > >
> > > > I also implement - (BOOL)fileManager:(NSFileManager *)manager
> > > > shouldProceedAfterError:(NSDictionary *)errorInfo; Dumping
> > > errorInfo
> > > > gives me the error (from the subject line of this message) and the
> > > > path in the notification. However, when I call [NSFileManager
> > > > directoryContentsAtPath], I can certainly list the files and
> > > > subdirectories (I've successfully dumped the returned array).
> > > Because
> > > > it's an automounted FAT32 volume, the mode on *everything* is 777.
> > > >
> > > > What did I miss? Thanks in advance...
> > > >
> > > > --Shon
> > > > _______________________________________________
> > > > Do not post admin requests to the list. They will be ignored.
> > > > Cocoa-dev mailing list (email@hidden)
> > > > Help/Unsubscribe/Update your Subscription:
> > > > 40silentalcove.net <http://40silentalcove.net>
> > > >
> > > > This email sent to email@hidden
> > > >
> > >
> > >
> >
> >
>
>
_______________________________________________
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