-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <rootless.h> | ||
#import "../Utils/NSBundle+YTMU.h" | ||
#import "ABCSwitch.h" | ||
|
||
static inline NSBundle *YTMusicUltimateBundle() { | ||
static NSBundle *bundle = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTMusicUltimate" ofType:@"bundle"]; | ||
NSString *rootlessBundlePath = ROOT_PATH_NS(@"/Library/Application Support/YTMusicUltimate.bundle"); | ||
|
||
bundle = [NSBundle bundleWithPath:tweakBundlePath ?: rootlessBundlePath]; | ||
}); | ||
|
||
return bundle; | ||
} | ||
|
||
static inline NSString *LOC(NSString *key) { | ||
return [YTMusicUltimateBundle() localizedStringForKey:key value:nil table:nil]; | ||
} | ||
#define LOC(key) [NSBundle.ytmu_defaultBundle localizedStringForKey:key value:nil table:nil] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <rootless.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NSBundle (YTMusicUltimate) | ||
|
||
@property (class, nonatomic, readonly) NSBundle *ytmu_defaultBundle; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#import "NSBundle+YTMU.h" | ||
|
||
@implementation NSBundle (YTMusicUltimate) | ||
|
||
+ (NSBundle *)ytmu_defaultBundle { | ||
static NSBundle *bundle = nil; | ||
static dispatch_once_t onceToken; | ||
|
||
dispatch_once(&onceToken, ^{ | ||
NSString *tweakBundlePath = [[NSBundle mainBundle] pathForResource:@"YTMusicUltimate" ofType:@"bundle"]; | ||
NSString *rootlessBundlePath = ROOT_PATH_NS(@"/Library/Application Support/YTMusicUltimate.bundle"); | ||
|
||
bundle = [NSBundle bundleWithPath:tweakBundlePath ?: rootlessBundlePath]; | ||
}); | ||
|
||
return bundle; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters