1. lawrence3526
  2. growl

Commits

Peter Hosey  committed 1f233a1

Improved error handling in the Installer package. If it fails to remove the old Growl, it'll now log an error message and return failure.

  • Participants
  • Parent commits b9fe9d5
  • Branches maintenance-1.2

Comments (0)

Files changed (2)

File Release/Growl/GrowlPreInstall/GrowlPreInstall.m

View file
  • Ignore whitespace
 @end
 
 int main (int argc, char **argv) {
+	int status = EXIT_SUCCESS;
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
 	NSAppleEventDescriptor *descriptor;
 
 	/* delete old Growl installations */
 	NSString *destinationDirectory = [NSString stringWithUTF8String:argv[2]];
-	if ([destinationDirectory hasPrefix:@"/Library"]) {
+	if (YES || [destinationDirectory hasPrefix:@"/Library"]) {
 		//We are installing to /Library/PreferencePanes, so delete a prefpane in the user Library if there is one.
 
 		//Get the home directory for the console (GUI) user from System Configuration, because NSHomeDirectory (at least under Leopard's Installer) will return the home directory for root.
 			homeDirectory = [NSString stringWithUTF8String:pwd->pw_dir];
 		}
 
-		[[NSFileManager defaultManager] removeFileAtPath:[[[homeDirectory
-															stringByAppendingPathComponent:@"Library"]
-														   stringByAppendingPathComponent:@"PreferencePanes"] 
-														  stringByAppendingPathComponent:@"Growl.prefPane"] handler:nil];
+		NSString *path = [[[homeDirectory
+			stringByAppendingPathComponent:@"Library"]
+			stringByAppendingPathComponent:@"PreferencePanes"] 
+			stringByAppendingPathComponent:@"Growl.prefPane"];
+		NSError *error = nil;
+		if (![[NSFileManager defaultManager] removeItemAtPath:path error:&error]) {
+			NSLog(@"Could not remove old prefpane at %@ while installing to %@ (preinstall running as user %@): Error %@", path, destinationDirectory, NSUserName(), error);
+			status = EXIT_FAILURE;
+		}
 	}
 
 	[pool release];
-	return 0;
+	return status;
 }

File Release/Growl/scripts/GrowlPreInstall

  • Ignore whitespace
Binary file modified.