mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2025-02-19 07:31:01 +00:00
find keyboard layouts from AppDelegate
This commit is contained in:
parent
22256824d2
commit
53cb92f4ef
@ -22,6 +22,7 @@ extern NSString *DocumentsChangedNotification;
|
||||
@property (nonatomic, readonly) NSString *emulatorBundlesPath;
|
||||
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
|
||||
@property (readonly, nonatomic) id<Emulator> sharedEmulator;
|
||||
@property (readonly, nonatomic) NSArray<NSString*> *keyboardLayoutPaths;
|
||||
|
||||
@property (class, readonly, strong) AppDelegate *sharedInstance NS_SWIFT_NAME(shared);
|
||||
@property (class, readonly, strong) id<Emulator> sharedEmulator NS_SWIFT_NAME(emulator);
|
||||
|
@ -257,6 +257,16 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
|
||||
return userKeyboardLayoutsPath;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)keyboardLayoutPaths {
|
||||
NSArray *keyboardLayouts = [[NSBundle mainBundle] pathsForResourcesOfType:@"nfkeyboardlayout" inDirectory:@"Keyboard Layouts"];
|
||||
NSString *userKeyboardLayoutsPath = [AppDelegate sharedInstance].userKeyboardLayoutsPath;
|
||||
NSArray *userKeyboardLayouts = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:userKeyboardLayoutsPath error:nil] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"pathExtension.lowercaseString = %@", @"nfkeyboardlayout"]];
|
||||
if (userKeyboardLayouts.count > 0) {
|
||||
keyboardLayouts = [keyboardLayouts arrayByAddingObjectsFromArray:userKeyboardLayouts];
|
||||
}
|
||||
return keyboardLayouts;
|
||||
}
|
||||
|
||||
- (BOOL)importFileToDocuments:(NSURL *)url copy:(BOOL)copy {
|
||||
if (url.fileURL) {
|
||||
// opening file
|
||||
|
@ -37,12 +37,7 @@ typedef enum : NSInteger {
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
keyboardLayouts = [[NSBundle mainBundle] pathsForResourcesOfType:@"nfkeyboardlayout" inDirectory:@"Keyboard Layouts"];
|
||||
NSString *userKeyboardLayoutsPath = [AppDelegate sharedInstance].userKeyboardLayoutsPath;
|
||||
NSArray *userKeyboardLayouts = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:userKeyboardLayoutsPath error:nil] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"pathExtension.lowercaseString = %@", @"nfkeyboardlayout"]];
|
||||
if (userKeyboardLayouts.count > 0) {
|
||||
keyboardLayouts = [keyboardLayouts arrayByAddingObjectsFromArray:userKeyboardLayouts];
|
||||
}
|
||||
keyboardLayouts = [AppDelegate sharedInstance].keyboardLayoutPaths;
|
||||
[self loadEmulatorBundles];
|
||||
[self loadCredits];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user