NSWorkspace Problems
NSWorkspace Problems
- Subject: NSWorkspace Problems
- From: Brendan Younger <email@hidden>
- Date: Wed, 4 Jul 2001 17:50:18 -0500
I've been having more than a few problems with NSWorkspace recently and
I just want to run over them with all of you on the list so as to make
sure I'm not over-looking anything silly and to see if you can reproduce
what I'm getting.
First, some of NSWorkspace's file operations don't seem to work.
Duplicate and recycle work fine when passed to this function, but
encrypt, decrypt, compress, and decompress don't. Please help.
- (void)outlineView:(NSOutlineView*)outlineView
doFileOperation:(NSString*)operation withRows:(NSArray*)files
{
int tag, i;
id file;
for(i = 0; i < [files count]; i++)
{
file = [outlineView itemAtRow:[[files objectAtIndex:i]
intValue]];
if(![[NSWorkspace sharedWorkspace]
performFileOperation:operation source:[[file path]
stringByDeletingLastPathComponent] destination:@"" files:[NSArray
arrayWithObject:[[file path] lastPathComponent]] tag:&tag])
{
NSLog(@"File operation %@ on %@ failed.", operation, [file
path]);
}
[[file parent] setIsDirty:YES];
}
[outlineView reloadData];
}
Also, the generic icons for file types aren't what I expect. They are
all just generic file icons, even the directory and application ones.
To test this, make a new project, make a window with five NSIconViews
and make your delegate do this:
- (void)applicationDidFinishLaunching:(NSNotification*)note
{
[one setImage:[[[NSWorkspace sharedWorkspace]
iconForFileType:NSPlainFileType] retain]];
[two setImage:[[[NSWorkspace sharedWorkspace]
iconForFileType:NSDirectoryFileType] retain]];
[three setImage:[[[NSWorkspace sharedWorkspace]
iconForFileType:NSApplicationFileType] retain]];
//[four setImage:[[[NSWorkspace sharedWorkspace]
iconForFileType:NSFilesystemFileType] retain]];
//[five setImage:[[[NSWorkspace sharedWorkspace]
iconForFileType:NSShellCommandFileType] retain]];
}
They are all file icons and the bottom two, NSFilesystemFileType and
NSShellCommandFileType cause -iconForFileType: to crash with a SIGSERV.
Also, when recycling files using the above -performFileOperation, the
recycled files do not show up in the trash until after logging in again.
ARRRRRRRRRRGGGGGGGGHHHHHHHH! Are these all well known bugs? Will they
be fixed by 10.1? Can I please break into tears now?
Brendan Younger