Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

correctly detect an error when trying to delete a plug-in that doesn'…

…t exist

the `removeItemAtPath:` method returns YES when the path is nil, masking the failure
  • Loading branch information...
commit 1b22bcb260d1798358fbd6547971b9b5bfdc025b 1 parent aa03540
@skurfer authored
View
16 Quicksilver/Code-QuickStepCore/QSPlugIn.m
@@ -473,18 +473,24 @@ - (BOOL)reveal {
inFileViewerRootedAtPath:@""];
}
- (BOOL)delete {
- NSString *ident/*, *path*/;
- if(bundle) {
+ NSString *ident, *path;
+ if (bundle) {
ident = [bundle bundleIdentifier];
-// path = [bundle bundlePath];
+ path = [bundle bundlePath];
} else {
ident = [data objectForKey:@"CFBundleIdentifier"];
-// path = nil;
+ path = nil;
}
id manager = [QSPlugInManager sharedInstance];
[[manager localPlugIns] removeObjectForKey:ident];
[[manager knownPlugIns] removeObjectForKey:ident];
- return [[NSFileManager defaultManager] removeItemAtPath:[bundle bundlePath] error:nil];
+ NSFileManager *fm = [NSFileManager defaultManager];
+ if ([fm fileExistsAtPath:path]) {
+ return [fm removeItemAtPath:path error:nil];
+ } else {
+ return NO;
+ }
+ return YES;
}
//------------------------
View
2  Quicksilver/Code-QuickStepCore/QSPlugInManager.m
@@ -322,7 +322,7 @@ - (void)deletePlugIns:(NSArray *)deletePlugIns fromWindow:(NSWindow *)window {
result = NSRunCriticalAlertPanel(@"Delete plug-ins?", @"Would you like to delete the selected plug-ins?", @"Delete", @"Cancel", nil);
if (result) {
- BOOL success = 1;
+ BOOL success = YES;
for(QSPlugIn * plugin in deletePlugIns) {
success = success && [plugin delete];
}
Please sign in to comment.
Something went wrong with that request. Please try again.