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

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


  • Subject: Re: NSFileManager - "Can't read directory contents" ??
  • From: Shon <email@hidden>
  • Date: Tue, 19 Jul 2005 21:37:38 -0400

OK, folks, after suggestions I'm still having the problem.  I take the
paths and standardize them, both paths exist with mode 777 (this is an
obvious future security problem), NSFileManager says the paths exists
and can list contents.

I'll take *any* other suggestions at this point. What causes
NSFileManager to say "Can't read directory contents"???


In Terminal:
myMac:~ shon$ ls -ald /Users/shon/temp /Volumes/SHONSD/
drwxrwxrwx   2 shon  shon    68B Jun  3 15:11 /Users/shon/temp/
drwxrwxrwx   1 shon  shon    16K Dec 31  1979 /Volumes/SHONSD//
myMac:~ shon$

Code:
BOOL copying=NO;
- (void)VolumeMounted: (NSNotification *)notification
{
	NSLog( @"rec'd NSWorkspaceDidMountNotification" );
	NSLog( @"Dumping userInfo from NSNotification" );
	NSLog( @"%@", [notification userInfo] );
	if (!copying) {
		copying=YES;

		NSString *source, *destination, *src, *dst;

		source = [[notification userInfo] valueForKey:@"NSDevicePath"];
		src = [source stringByStandardizingPath];
		NSLog( @"Standardized src: %@", src );

		[currentOperationField setStringValue:@"Copying..."];

		destination = @"/Users/shon/temp";
		dst = [destination stringByStandardizingPath];
		NSLog( @"Standardized dst: %@", dst );

		NSFileManager *fm = [NSFileManager defaultManager];


		NSArray *filelist;
		BOOL exists;

		[fm fileExistsAtPath:src isDirectory:&exists];
		NSLog( @"src exists? %@", exists?@"YES":@"NO" );

		filelist = [fm directoryContentsAtPath:src];
		NSLog( @"directory contents of src" );
		NSLog( @"%@", filelist );


		[fm fileExistsAtPath:dst isDirectory:&exists];
		NSLog( @"dst exists? %@", exists?@"YES":@"NO" );

		filelist = [fm directoryContentsAtPath:dst];
		NSLog( @"directory contents of dst" );
		NSLog( @"%@", filelist );


		if ([fm copyPath:src toPath:dst handler:self])
			[currentOperationField setStringValue:@"Copy complete!"];
		else
			[currentOperationField setStringValue:@"Error while copying"];

		copying=NO;
	}
}

- (BOOL)fileManager:(NSFileManager *)manager
shouldProceedAfterError:(NSDictionary *)errorInfo
{
	NSLog( @"********** Something went wrong, dumping errorInfo" );
	NSLog( @"%@", errorInfo );

	NSArray *keys = [errorInfo allKeys];

	return [keys count]==0;
}

- (void)fileManager:(NSFileManager *)manager willProcessPath:(NSString *)path
{
	NSLog( @"willProcessPath:" );
	NSLog( @"%@", path );
}

Log:
[Session started at 2005-07-19 21:28:10 -0400.]
2005-07-19 21:28:10.539 Photography Assistant[5509] awaking from nib
2005-07-19 21:28:15.252 Photography Assistant[5509] rec'd
NSWorkspaceDidMountNotification
2005-07-19 21:28:15.252 Photography Assistant[5509] Dumping userInfo
from NSNotification
2005-07-19 21:28:15.253 Photography Assistant[5509] {NSDevicePath =
"/Volumes/SHONSD"; }
2005-07-19 21:28:15.253 Photography Assistant[5509] Standardized src:
/Volumes/SHONSD
2005-07-19 21:28:15.253 Photography Assistant[5509] Standardized dst:
/Users/shon/temp
2005-07-19 21:28:15.253 Photography Assistant[5509] src exists? YES
2005-07-19 21:28:15.310 Photography Assistant[5509] directory contents of src
2005-07-19 21:28:15.310 Photography Assistant[5509] (
    DCIM,
    PALM,
    ".Trashes",
    ".DS_Store",
    "Notes.txt",
)
2005-07-19 21:28:15.311 My App[5509] dst exists? YES
2005-07-19 21:28:15.311 My App[5509] directory contents of dst
2005-07-19 21:28:15.311 My App[5509] ()
2005-07-19 21:28:15.312 My App[5509] willProcessPath:
2005-07-19 21:28:15.312 My App[5509] /Users/shon/temp
2005-07-19 21:28:15.312 My App[5509] ********** Something went wrong,
dumping errorInfo
2005-07-19 21:28:15.312 My App[5509] {Error = "Can't read directory
contents"; Path = "/Volumes/SHONSD"; }


--Shon

On 7/19/05, email@hidden <email@hidden> wrote:
>
> [snip]
>
 _______________________________________________
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: Shon <email@hidden>
References: 
 >NSFileManager - "Can't read directory contents" ?? (From: Shon <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: SA Dev <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: Shon <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: SA Dev <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: Shon <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: SA Dev <email@hidden>)
 >Re: NSFileManager - "Can't read directory contents" ?? (From: Shon <email@hidden>)

  • Prev by Date: NSAppleScript hangs
  • Next by Date: Re: NSFileManager - "Can't read directory contents" ??
  • Previous by thread: Re: NSFileManager - "Can't read directory contents" ??
  • Next by thread: Re: NSFileManager - "Can't read directory contents" ??
  • Index(es):
    • Date
    • Thread