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; isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
dstPath = ""; dstPath = "";
dstSubfolderSpec = 13; dstSubfolderSpec = 10;
files = ( files = (
281BB6C91D231F7700BF87B0 /* MacII-640x480.framework in Embed Frameworks */, 281BB6C91D231F7700BF87B0 /* MacII-640x480.framework in Embed Frameworks */,
289710DF1CFB12660089D463 /* Mac128K.framework in Embed Frameworks */, 289710DF1CFB12660089D463 /* Mac128K.framework in Embed Frameworks */,
@ -831,7 +831,7 @@
28F676BB1CD15E0B00FC6FA6 /* Resources */, 28F676BB1CD15E0B00FC6FA6 /* Resources */,
28F6B4CD1CF76D88002D76D0 /* Set Git version in Info.plist */, 28F6B4CD1CF76D88002D76D0 /* Set Git version in Info.plist */,
283422D61CF8EF8C0088B634 /* Embed Frameworks */, 283422D61CF8EF8C0088B634 /* Embed Frameworks */,
283422F51CF9ACAD0088B634 /* Change PlugIn extensions to mnvm */, 283422F51CF9ACAD0088B634 /* Change emulator bundle extensions to mnvm */,
); );
buildRules = ( buildRules = (
); );
@ -1015,19 +1015,19 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
283422F51CF9ACAD0088B634 /* Change PlugIn extensions to mnvm */ = { 283422F51CF9ACAD0088B634 /* Change emulator bundle extensions to mnvm */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
inputPaths = ( inputPaths = (
); );
name = "Change PlugIn extensions to mnvm"; name = "Change emulator bundle extensions to mnvm";
outputPaths = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; 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 */ = { 28F6B4CD1CF76D88002D76D0 /* Set Git version in Info.plist */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;

View File

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

View File

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

View File

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

View File

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