mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Cache resolved app bundle
This commit is contained in:
parent
820b038bbc
commit
41f05c73d8
@ -1,15 +1,21 @@
|
||||
#import <AppBundle/AppBundle.h>
|
||||
|
||||
NSBundle * _Nonnull getAppBundle() {
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) {
|
||||
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
|
||||
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"framework"]) {
|
||||
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
|
||||
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"Frameworks"]) {
|
||||
bundle = [NSBundle bundleWithURL:[bundle.bundleURL URLByDeletingLastPathComponent]];
|
||||
}
|
||||
return bundle;
|
||||
static NSBundle *appBundle = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
if ([[bundle.bundleURL pathExtension] isEqualToString:@"appex"]) {
|
||||
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
|
||||
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"framework"]) {
|
||||
bundle = [NSBundle bundleWithURL:[[bundle.bundleURL URLByDeletingLastPathComponent] URLByDeletingLastPathComponent]];
|
||||
} else if ([[bundle.bundleURL pathExtension] isEqualToString:@"Frameworks"]) {
|
||||
bundle = [NSBundle bundleWithURL:[bundle.bundleURL URLByDeletingLastPathComponent]];
|
||||
}
|
||||
appBundle = bundle;
|
||||
});
|
||||
|
||||
return appBundle;
|
||||
}
|
||||
|
||||
@implementation UIImage (AppBundle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user