put emulator bundles in Frameworks instead of PlugIns

fixes sideloading with AltStore
This commit is contained in:
Jesús A. Álvarez 2020-06-22 14:34:08 +02:00
parent 95756edc1f
commit 9a76a98ef9
5 changed files with 17 additions and 18 deletions

View File

@ -159,7 +159,7 @@
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
dstSubfolderSpec = 10;
files = (
281BB6C91D231F7700BF87B0 /* MacII-640x480.framework in Embed Frameworks */,
289710DF1CFB12660089D463 /* Mac128K.framework in Embed Frameworks */,
@ -831,7 +831,7 @@
28F676BB1CD15E0B00FC6FA6 /* Resources */,
28F6B4CD1CF76D88002D76D0 /* Set Git version in Info.plist */,
283422D61CF8EF8C0088B634 /* Embed Frameworks */,
283422F51CF9ACAD0088B634 /* Change PlugIn extensions to mnvm */,
283422F51CF9ACAD0088B634 /* Change emulator bundle extensions to mnvm */,
);
buildRules = (
);
@ -1015,19 +1015,19 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
283422F51CF9ACAD0088B634 /* Change PlugIn extensions to mnvm */ = {
283422F51CF9ACAD0088B634 /* Change emulator bundle extensions to mnvm */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Change PlugIn extensions to mnvm";
name = "Change emulator bundle extensions to mnvm";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PLUGINS_FOLDER_PATH\"\nrm -rf *.mnvm\nfor name in *.framework\ndo\n mv \"$name\" \"${name%.framework}.mnvm\"\ndone\n";
shellScript = "cd \"$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH\"\nrm -rf *.mnvm\nfor name in *.framework\ndo\n mv \"$name\" \"${name%.framework}.mnvm\"\ndone\n";
};
28F6B4CD1CF76D88002D76D0 /* Set Git version in Info.plist */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@ -38,11 +36,11 @@
ReferencedContainer = "container:Mini vMac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
@ -71,8 +69,6 @@
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -19,6 +19,7 @@ extern NSString *DocumentsChangedNotification;
@property (nonatomic, readonly) NSString *userKeyboardLayoutsPath;
@property (nonatomic, readonly) NSArray<NSString*> *diskImageExtensions;
@property (nonatomic, readonly) NSArray<NSBundle*> *emulatorBundles;
@property (nonatomic, readonly) NSString *emulatorBundlesPath;
@property (readonly, nonatomic, getter = isSandboxed) BOOL sandboxed;
+ (instancetype)sharedInstance;

View File

@ -84,12 +84,15 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
}
}
- (NSString*)emulatorBundlesPath {
return [NSBundle mainBundle].privateFrameworksPath;
}
- (NSArray<NSBundle*>*)emulatorBundles {
NSString *pluginsPath = [NSBundle mainBundle].builtInPlugInsPath;
NSArray<NSString*> *names = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:pluginsPath error:NULL];
NSArray<NSString*> *names = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self.emulatorBundlesPath error:NULL];
NSMutableArray *emulatorBundles = [NSMutableArray arrayWithCapacity:names.count];
for (NSString *name in [names pathsMatchingExtensions:@[@"mnvm"]]) {
NSBundle *bundle = [NSBundle bundleWithPath:[pluginsPath stringByAppendingPathComponent:name]];
NSBundle *bundle = [NSBundle bundleWithPath:[self.emulatorBundlesPath stringByAppendingPathComponent:name]];
[emulatorBundles addObject:bundle];
}
return emulatorBundles;
@ -97,7 +100,7 @@ NSString *DocumentsChangedNotification = @"documentsChanged";
- (BOOL)loadEmulator:(NSString*)name {
NSString *emulatorBundleName = [name stringByAppendingPathExtension:@"mnvm"];
NSString *emulatorBundlePath = [[NSBundle mainBundle].builtInPlugInsPath stringByAppendingPathComponent:emulatorBundleName];
NSString *emulatorBundlePath = [self.emulatorBundlesPath stringByAppendingPathComponent:emulatorBundleName];
NSBundle *emulatorBundle = [NSBundle bundleWithPath:emulatorBundlePath];
[emulatorBundle load];
sharedEmulator = [[emulatorBundle principalClass] new];

View File

@ -247,7 +247,6 @@ typedef enum : NSInteger {
BOOL rowIsHeader = [item isKindOfClass:[NSString class]];
BOOL rowHasHeader = [groupedEmulatorBundles containsObject:item];
NSBundle *bundle = rowIsHeader ? machineList[indexPath.row + 1] : item;
NSString *bundleName = bundle.bundlePath.lastPathComponent.stringByDeletingPathExtension;
cell = [tableView dequeueReusableCellWithIdentifier:@"machine" forIndexPath:indexPath];
if (rowIsHeader) {
cell.textLabel.text = [bundle objectForInfoDictionaryKey:@"CFBundleDisplayName"];
@ -264,7 +263,7 @@ typedef enum : NSInteger {
cell.imageView.image = nil;
cell.indentationLevel = 1;
} else {
NSString *iconName = [NSString stringWithFormat:@"PlugIns/%@.mnvm/Icon", bundleName];
NSString *iconName = [NSString stringWithFormat:@"%@/Icon", bundle.bundlePath];
cell.imageView.image = [UIImage imageNamed:iconName];
cell.indentationLevel = 0;
}