• 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
NSFileManager - "Can't read directory contents" ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileManager - "Can't read directory contents" ??


  • Subject: NSFileManager - "Can't read directory contents" ??
  • From: Shon <email@hidden>
  • Date: Mon, 18 Jul 2005 21:01:41 -0400

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSFileManager - "Can't read directory contents" ??
      • From: SA Dev <email@hidden>
  • Prev by Date: Re: [RESOLVED] [[NSBundle mainBundle] bundlePath] and trailng slashes...
  • Next by Date: programmatically inserted dock items not showing up
  • Previous by thread: Re: NEWBIE - thanks atoshi Matsumoto
  • Next by thread: Re: NSFileManager - "Can't read directory contents" ??
  • Index(es):
    • Date
    • Thread