mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-09-27 12:59:00 +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 (nonatomic, readonly) NSString *emulatorBundlesPath;
|
||||||
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
|
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
|
||||||
@property (readonly, nonatomic) id<Emulator> sharedEmulator;
|
@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) AppDelegate *sharedInstance NS_SWIFT_NAME(shared);
|
||||||
@property (class, readonly, strong) id<Emulator> sharedEmulator NS_SWIFT_NAME(emulator);
|
@property (class, readonly, strong) id<Emulator> sharedEmulator NS_SWIFT_NAME(emulator);
|
||||||
|
@ -257,6 +257,16 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
|
|||||||
return userKeyboardLayoutsPath;
|
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 {
|
- (BOOL)importFileToDocuments:(NSURL *)url copy:(BOOL)copy {
|
||||||
if (url.fileURL) {
|
if (url.fileURL) {
|
||||||
// opening file
|
// opening file
|
||||||
|
@ -37,12 +37,7 @@ typedef enum : NSInteger {
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
keyboardLayouts = [[NSBundle mainBundle] pathsForResourcesOfType:@"nfkeyboardlayout" inDirectory:@"Keyboard Layouts"];
|
keyboardLayouts = [AppDelegate sharedInstance].keyboardLayoutPaths;
|
||||||
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];
|
|
||||||
}
|
|
||||||
[self loadEmulatorBundles];
|
[self loadEmulatorBundles];
|
||||||
[self loadCredits];
|
[self loadCredits];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user