Skip to content
Permalink
Browse files

Bundler: more fixes to icon handling.

  • Loading branch information
alunbestor committed Feb 23, 2016
1 parent fbc32ca commit ccaa382d20eb349fff7eacb898d12c9c0adf28ab
Showing with 31 additions and 4 deletions.
  1. +22 −4 Bundler/BBAppDelegate+AppExporting.m
  2. +1 −0 Bundler/BBAppDelegate.h
  3. +8 −0 Bundler/BBAppDelegate.m
@@ -82,14 +82,18 @@ - (NSURL *) createAppAtDestinationURL: (NSURL *)destinationURL

appInfo[@"BXBundledGameboxName"] = importedGameboxURL.lastPathComponent;

//Copy across the application icon.
if (self.appIconURL || self.iconDropzone.image)
//If an icon has been provided, either copy across the icon file as-is
//(if it was a valid ICNS-format icon) or recreate an ICNs from the NSImage.
BOOL hasURLToValidIcon = [self.appIconURL conformsToFileType: (NSString *)kUTTypeAppleICNS];

if (hasURLToValidIcon || self.iconDropzone.image)
{
NSURL *iconURL;
if (self.appIconURL)
if (hasURLToValidIcon)
iconURL = [self _applyIconFromURL: self.appIconURL toAppAtURL: tempAppURL error: outError];
else
iconURL = [self _applyIcon: self.iconDropzone.image toAppAtURL: tempAppURL error: outError];

if (iconURL == nil)
{
[manager removeItemAtURL: baseTempURL error: NULL];
@@ -275,7 +279,7 @@ - (NSURL *) createAppAtDestinationURL: (NSURL *)destinationURL
}
}

//Finally, move the finished and (hopefully) codesigned app
//Once the app is ready, move the finished and (hopefully) codesigned app
//from the temporary location to the final destination.
NSURL *finalDestinationURL = nil;
BOOL swapped = [manager replaceItemAtURL: destinationURL
@@ -287,6 +291,20 @@ - (NSURL *) createAppAtDestinationURL: (NSURL *)destinationURL

if (swapped)
{
//TODO: once it's in place, update the resulting file's modification date.
NSError *touchError;
BOOL touched = [destinationURL setResourceValue: [NSDate date]
forKey: NSURLContentModificationDateKey
error: &touchError];
if (touched)
{
NSLog(@"Touched file successfully.");
}
else
{
NSLog(@"Touch failed with error: %@", touchError);
}

return finalDestinationURL;
}
else
@@ -96,4 +96,5 @@ enum {

//Given the URL of a gamebox, returns an array of launch options found inside that gamebox.
+ (NSArray *) launchersForGameboxAtURL: (NSURL *)gameboxURL;

@end
@@ -778,6 +778,14 @@ - (IBAction) chooseIconURL: (id)sender
if (result == NSFileHandlingPanelOKButton)
{
self.appIconURL = panel.URL;
if (self.appIconURL != nil)
{
self.iconDropzone.image = [[NSImage alloc] initWithContentsOfURL: self.appIconURL];
}
else
{
self.iconDropzone.image = nil;
}
}
}];
}

0 comments on commit ccaa382

Please sign in to comment.
You can’t perform that action at this time.