25 |
|
|
26 |
|
TODO: |
27 |
|
|
28 |
– |
Verify if VM exists |
28 |
|
Drag VM from Finder to import |
29 |
|
When choosing things like rom file and keycode files - have a checkbox to copy |
30 |
|
selected file into the bundle. |
85 |
|
[vmList registerForDraggedTypes:[NSArray arrayWithObjects:VM_DRAG_TYPE, nil]]; |
86 |
|
} |
87 |
|
|
88 |
+ |
- (void) _showNotFoundAlert |
89 |
+ |
{ |
90 |
+ |
NSAlert *alert = [[[NSAlert alloc] init] autorelease]; |
91 |
+ |
[alert setMessageText:@"The virtual machine cannot be found."]; |
92 |
+ |
[alert setAlertStyle:NSWarningAlertStyle]; |
93 |
+ |
[alert beginSheetModalForWindow:[self window] |
94 |
+ |
modalDelegate:self |
95 |
+ |
didEndSelector:nil |
96 |
+ |
contextInfo:nil]; |
97 |
+ |
} |
98 |
+ |
|
99 |
|
- (void) reloadDataAndSave |
100 |
|
{ |
101 |
|
[vmList reloadData]; |
127 |
|
NSString *currentPath = [vmArray objectAtIndex: r]; |
128 |
|
NSString *newPath = [[NSString stringWithFormat:@"%@/%@.sheepvm", |
129 |
|
[currentPath stringByDeletingLastPathComponent], value] retain]; |
130 |
< |
NSFileManager *manager = [NSFileManager defaultManager]; |
131 |
< |
if ([manager movePath: currentPath toPath: newPath handler:nil]) { |
132 |
< |
[vmArray replaceObjectAtIndex: r withObject: newPath]; |
133 |
< |
[currentPath release]; |
130 |
> |
if (![currentPath isEqual:newPath]) { |
131 |
> |
if ([[NSFileManager defaultManager] fileExistsAtPath:currentPath]) { |
132 |
> |
NSFileManager *manager = [NSFileManager defaultManager]; |
133 |
> |
if ([manager movePath: currentPath toPath: newPath handler:nil]) { |
134 |
> |
[vmArray replaceObjectAtIndex: r withObject: newPath]; |
135 |
> |
[currentPath release]; |
136 |
> |
} |
137 |
> |
} else { |
138 |
> |
[self _showNotFoundAlert]; |
139 |
> |
} |
140 |
|
} |
141 |
|
} |
142 |
|
|
287 |
|
modalDelegate:self |
288 |
|
didEndSelector:nil |
289 |
|
contextInfo:nil]; |
290 |
< |
} else { |
290 |
> |
} else if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { |
291 |
|
[[VMSettingsController sharedInstance] editSettingsFor:path sender:sender]; |
292 |
+ |
} else { |
293 |
+ |
[self _showNotFoundAlert]; |
294 |
|
} |
295 |
|
} |
296 |
|
} |
308 |
|
modalDelegate:self |
309 |
|
didEndSelector:nil |
310 |
|
contextInfo:nil]; |
311 |
< |
} else { |
311 |
> |
} else if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { |
312 |
|
NSTask *sheep = [[NSTask alloc] init]; |
313 |
|
[sheep setLaunchPath:[[NSBundle mainBundle] pathForAuxiliaryExecutable:@"SheepShaver"]]; |
314 |
|
[sheep setArguments:[NSArray arrayWithObject:path]]; |
315 |
|
[sheep launch]; |
316 |
|
[tasks setObject:sheep forKey:path]; |
317 |
+ |
} else { |
318 |
+ |
[self _showNotFoundAlert]; |
319 |
|
} |
320 |
|
} |
321 |
|
} |
347 |
|
modalDelegate:self |
348 |
|
didEndSelector:@selector(_deleteVirtualMachineDone: returnCode: contextInfo:) |
349 |
|
contextInfo:nil]; |
330 |
– |
|
350 |
|
} |
351 |
|
} |
352 |
|
|
363 |
|
{ |
364 |
|
int selectedRow = [vmList selectedRow]; |
365 |
|
if (selectedRow >= 0) { |
366 |
< |
[[NSWorkspace sharedWorkspace] selectFile: [vmArray objectAtIndex:selectedRow] inFileViewerRootedAtPath: @""]; |
366 |
> |
NSString *path = [vmArray objectAtIndex:selectedRow]; |
367 |
> |
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { |
368 |
> |
[[NSWorkspace sharedWorkspace] selectFile: path inFileViewerRootedAtPath: @""]; |
369 |
> |
} else { |
370 |
> |
[self _showNotFoundAlert]; |
371 |
> |
} |
372 |
|
} |
373 |
|
} |
374 |
|
|