mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-29 05:24:26 +00:00
* origin/master: Explain why I'm not relying on the compiler to throw linkage errors Add AppKitPrevention header to reduce redundancy. Add AppKit prevention guards to modules that shouldn't import it Add Obj-C generics where applicable Adds test cases for "sparkle:criticalUpdate" tag. (#999)
35 lines
928 B
Objective-C
35 lines
928 B
Objective-C
//
|
|
// SUBundleIcon.m
|
|
// Sparkle
|
|
//
|
|
// Created by Mayur Pawashe on 7/24/16.
|
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
|
//
|
|
|
|
#import "SUBundleIcon.h"
|
|
#import "SUHost.h"
|
|
|
|
|
|
#include "AppKitPrevention.h"
|
|
|
|
@implementation SUBundleIcon
|
|
|
|
// Note: To obtain the most current bundle icon file from the Info dictionary, this should take a SUHost, not a NSBundle
|
|
+ (NSURL *)iconURLForHost:(SUHost *)host
|
|
{
|
|
NSString *resource = [host objectForInfoDictionaryKey:@"CFBundleIconFile"];
|
|
if (resource == nil || ![resource isKindOfClass:[NSString class]]) {
|
|
return nil;
|
|
}
|
|
|
|
NSURL *iconURL = [host.bundle URLForResource:resource withExtension:@"icns"];
|
|
|
|
// The resource could already be containing the path extension, so try again without the extra extension
|
|
if (iconURL == nil) {
|
|
iconURL = [host.bundle URLForResource:resource withExtension:nil];
|
|
}
|
|
return iconURL;
|
|
}
|
|
|
|
@end
|