From 29ed03ed12512a3e7d7a957c69808b75a8140e26 Mon Sep 17 00:00:00 2001 From: opa334 Date: Mon, 25 Mar 2019 15:09:50 +0100 Subject: [PATCH 1/6] Add Simulator compile target, add simulator install script, add a script to compile a universal dylib that can be linked from both simulator and device targets --- Makefile | 11 +++++++ create_universal.sh | 8 +++++ install_simulator.sh | 32 +++++++++++++++++++ source/Cells/CSColorDisplayCell.m | 14 ++++---- .../Controllers/CSColorPickerViewController.m | 14 ++++---- source/simulator.h | 14 ++++++++ source/simulator.m | 19 +++++++++++ 7 files changed, 100 insertions(+), 12 deletions(-) create mode 100755 create_universal.sh create mode 100755 install_simulator.sh create mode 100644 source/simulator.h create mode 100644 source/simulator.m diff --git a/Makefile b/Makefile index db1842d..2a56bb6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ +SIMULATOR ?= 0 + +ifeq ($(SIMULATOR), 1) +ARCHS = i386 x86_64 +TARGET = simulator:clang:9.2:9.0 +else ARCHS = armv7 armv7s arm64 TARGET = iphone:clang:11.2:9.0 +endif GO_EASY_ON_ME = 0 FINALPACKAGE = 1 @@ -13,6 +20,10 @@ $(LIBRARY_NAME)_FRAMEWORKS = UIKit CoreGraphics CoreFoundation $(LIBRARY_NAME)_PRIVATE_FRAMEWORKS = Preferences $(LIBRARY_NAME)_CFLAGS += -fobjc-arc -I$(THEOS_PROJECT_DIR)/source +ifeq ($(SIMULATOR), 1) +$(LIBRARY_NAME)_CFLAGS += -D SIMULATOR=1 +endif + after-install:: install.exec "killall -9 Preferences" diff --git a/create_universal.sh b/create_universal.sh new file mode 100755 index 0000000..3c457ef --- /dev/null +++ b/create_universal.sh @@ -0,0 +1,8 @@ +set -e + +make + +make SIMULATOR=1 + +lipo ./.theos/obj/iphone_simulator/libCSColorPicker.dylib ./.theos/obj/libCSColorPicker.dylib -output ./libCSColorPicker.dylib -create +# Creates a dylib that can be properly linked from tweaks targetting both simulator and real devices diff --git a/install_simulator.sh b/install_simulator.sh new file mode 100755 index 0000000..a0d2551 --- /dev/null +++ b/install_simulator.sh @@ -0,0 +1,32 @@ +set -e + +make SIMULATOR=1 + +THEOS_OBJ_DIR=./.theos/obj/iphone_simulator + +#install PreferenceBundle into all additionally installed simulators + +for runtime in /Library/Developer/CoreSimulator/Profiles/Runtimes/* +do + echo "Installing libCSColorPicker to $runtime" + + SIMULATOR_ROOT=$runtime/Contents/Resources/RuntimeRoot + SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib + + if [ -d "$SIMULATOR_LIB_PATH" ]; then + sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: + sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" + fi +done + +#install PreferenceBundle into the simulator that ships with Xcode + +echo "Installing libCSColorPicker to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime" + +SIMULATOR_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot +SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib + +if [ -d "$SIMULATOR_LIB_PATH" ]; then + sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: + sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" +fi diff --git a/source/Cells/CSColorDisplayCell.m b/source/Cells/CSColorDisplayCell.m index 4190708..c3c462a 100644 --- a/source/Cells/CSColorDisplayCell.m +++ b/source/Cells/CSColorDisplayCell.m @@ -5,6 +5,8 @@ #import +#import + // get the associated view controller from a UIView // credits https://stackoverflow.com/questions/1372977/given-a-view-how-do-i-get-its-viewcontroller/24590678 #define UIViewParentController(__view) ({ UIResponder *__responder = __view; while ([__responder isKindOfClass:[UIView class]]) __responder = [__responder nextResponder]; (UIViewController *)__responder; }) @@ -29,11 +31,11 @@ - (void)refreshCellContentsWithSpecifier:(PSSpecifier *)specifier { } - (void)refreshCellWithColor:(UIColor *)color { - + if (!color) { color = [self previewColor]; } - + self.cellColorDisplay.backgroundColor = color; self.detailTextLabel.text = [NSString stringWithFormat:@"#%@", [color hexString]]; } @@ -109,9 +111,9 @@ - (UIColor *)previewColor { NSDictionary *prefsDict, *defaultsDict; UIColor *color; - userPrefsPath = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", [self.specifier propertyForKey:@"defaults"]]; - defaultsPlistPath = [[NSBundle bundleWithPath:[self.specifier propertyForKey:@"defaultsPath"]] pathForResource:@"defaults" ofType:@"plist"]; - motuumLSDefaultsPath = [[NSBundle bundleWithPath:@"/Library/PreferenceBundles/motuumLS.bundle"] pathForResource:@"com.creaturesurvive.motuumls_defaults" ofType:@"plist"]; + userPrefsPath = rPath([NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", [self.specifier propertyForKey:@"defaults"]]); + defaultsPlistPath = rPath([[NSBundle bundleWithPath:[self.specifier propertyForKey:@"defaultsPath"]] pathForResource:@"defaults" ofType:@"plist"]); + motuumLSDefaultsPath = rPath([[NSBundle bundleWithPath:@"/Library/PreferenceBundles/motuumLS.bundle"] pathForResource:@"com.creaturesurvive.motuumls_defaults" ofType:@"plist"]); if ((prefsDict = [NSDictionary dictionaryWithContentsOfFile:userPrefsPath])) { hex = prefsDict[[self.specifier propertyForKey:@"key"]]; @@ -129,7 +131,7 @@ - (UIColor *)previewColor { hex = [self.specifier propertyForKey:@"fallback"] ? : @"FF0000)"; } - color = [UIColor colorFromHexString:hex]; + color = [UIColor colorFromHexString:hex]; [self.specifier setProperty:hex forKey:@"hexValue"]; [self.specifier setProperty:color forKey:@"color"]; diff --git a/source/Controllers/CSColorPickerViewController.m b/source/Controllers/CSColorPickerViewController.m index 289fbf3..1d95f38 100644 --- a/source/Controllers/CSColorPickerViewController.m +++ b/source/Controllers/CSColorPickerViewController.m @@ -5,6 +5,8 @@ #import +#import + @implementation CSColorPickerViewController - (void)viewDidLoad { @@ -173,7 +175,7 @@ - (void)setColor:(UIColor *)color { [self setColorInformationTextWithInformationFromColor:color]; [self.specifier setValue:[NSString stringWithFormat:@"%@:%f", [color hexString], color.alpha] forKey:@"hexValue"]; } @catch (NSException *e) { - CSError(@"%@", e.description); + //CSError(@"%@", e.description); } } @@ -237,10 +239,10 @@ - (void)saveColor { NSString *key = [self.specifier propertyForKey:@"key"]; NSString *defaults = [self.specifier propertyForKey:@"defaults"]; - NSString *plistPath = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", defaults]; + NSString *plistPath = rPath([NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", defaults]); NSMutableDictionary *prefsDict = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath] ? : [NSMutableDictionary new]; CSColorDisplayCell *cell = (CSColorDisplayCell *)[self.specifier propertyForKey:@"cellObject"]; - + // save via plist [prefsDict setObject:color forKey:key]; [prefsDict writeToFile:plistPath atomically:NO]; @@ -251,17 +253,17 @@ - (void)saveColor { // save in domain for NSUserDefaults [[NSUserDefaults standardUserDefaults] setObject:color forKey:key inDomain:defaults]; - + if (cell) [cell refreshCellWithColor:[self colorForRGBSliders]]; - + if ([self.specifier propertyForKey:@"PostNotification"]) CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)[self.specifier propertyForKey:@"PostNotification"], (CFStringRef)[self.specifier propertyForKey:@"PostNotification"], NULL, YES); - + if ([self.specifier propertyForKey:@"callbackAction"]) { SEL callback = NSSelectorFromString([self.specifier propertyForKey:@"callbackAction"]); if ([self.specifier.target respondsToSelector:callback]) { diff --git a/source/simulator.h b/source/simulator.h new file mode 100644 index 0000000..8cbb074 --- /dev/null +++ b/source/simulator.h @@ -0,0 +1,14 @@ +#ifdef SIMULATOR + +@interface UIView () +@property(nonatomic, readonly) UIEdgeInsets safeAreaInsets; //9.2 sdk needed for simulator and this property was added in 11 +@end + +extern NSString* simulatorPath(NSString* path); +#define rPath(args ...) ({ simulatorPath(args); }) + +#else + +#define rPath(args ...) ({ args; }) + +#endif diff --git a/source/simulator.m b/source/simulator.m new file mode 100644 index 0000000..e409565 --- /dev/null +++ b/source/simulator.m @@ -0,0 +1,19 @@ +#ifdef SIMULATOR + +extern NSString *UISystemRootDirectory(); + +#define currentUser NSHomeDirectory().pathComponents[2] + +NSString* simulatorPath(NSString* path) +{ + if([path hasPrefix:@"/var/mobile/"] || [path hasPrefix:@"/User/"]) + { + NSString* simulatorID = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject].pathComponents[7]; + NSString* strippedPath = [path stringByReplacingOccurrencesOfString:@"/var/mobile/" withString:@""]; + strippedPath = [strippedPath stringByReplacingOccurrencesOfString:@"/User/" withString:@""]; + return [NSString stringWithFormat:@"/Users/%@/Library/Developer/CoreSimulator/Devices/%@/data/%@", currentUser, simulatorID, strippedPath]; + } + return [UISystemRootDirectory() stringByAppendingPathComponent:path]; +} + +#endif From bbafd0a8e0ef370db20ba8dda01d875cd647b762 Mon Sep 17 00:00:00 2001 From: opa334 Date: Mon, 25 Mar 2019 15:11:28 +0100 Subject: [PATCH 2/6] Fix comment --- install_simulator.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_simulator.sh b/install_simulator.sh index a0d2551..c658f24 100755 --- a/install_simulator.sh +++ b/install_simulator.sh @@ -4,7 +4,7 @@ make SIMULATOR=1 THEOS_OBJ_DIR=./.theos/obj/iphone_simulator -#install PreferenceBundle into all additionally installed simulators +#install libCSColorPicker into all additionally installed simulators for runtime in /Library/Developer/CoreSimulator/Profiles/Runtimes/* do @@ -19,7 +19,7 @@ do fi done -#install PreferenceBundle into the simulator that ships with Xcode +#install libCSColorPicker into the simulator that ships with Xcode echo "Installing libCSColorPicker to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime" From db036af5cbbb78f9e3293323843134d858387689 Mon Sep 17 00:00:00 2001 From: opa334 Date: Mon, 25 Mar 2019 15:13:26 +0100 Subject: [PATCH 3/6] Uncomment CSError --- source/Controllers/CSColorPickerViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Controllers/CSColorPickerViewController.m b/source/Controllers/CSColorPickerViewController.m index 1d95f38..d29f78c 100644 --- a/source/Controllers/CSColorPickerViewController.m +++ b/source/Controllers/CSColorPickerViewController.m @@ -175,7 +175,7 @@ - (void)setColor:(UIColor *)color { [self setColorInformationTextWithInformationFromColor:color]; [self.specifier setValue:[NSString stringWithFormat:@"%@:%f", [color hexString], color.alpha] forKey:@"hexValue"]; } @catch (NSException *e) { - //CSError(@"%@", e.description); + CSError(@"%@", e.description); } } From d79eae33be714c6cdd2024b5cb9b1d88de1fc565 Mon Sep 17 00:00:00 2001 From: opa334 Date: Thu, 29 Aug 2019 16:06:36 +0200 Subject: [PATCH 4/6] fix conflicts --- Makefile | 4 +-- source/Cells/CSColorDisplayCell.m | 21 +++----------- source/Cells/CSGradientDisplayCell.m | 12 +++++--- .../Controllers/CSColorPickerViewController.m | 28 ++++--------------- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index cd70828..7a72b21 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ SIMULATOR ?= 0 ifeq ($(SIMULATOR), 1) ARCHS = i386 x86_64 -TARGET = simulator:clang:9.2:9.0 +TARGET = simulator:clang:12.1:9.0 else ARCHS = armv7 armv7s arm64 arm64e -TARGET = iphone:clang:11.2:9.0 +TARGET = iphone:clang:12.1.2:9.0 endif GO_EASY_ON_ME = 0 diff --git a/source/Cells/CSColorDisplayCell.m b/source/Cells/CSColorDisplayCell.m index 24dc51d..590e3c3 100644 --- a/source/Cells/CSColorDisplayCell.m +++ b/source/Cells/CSColorDisplayCell.m @@ -5,15 +5,12 @@ #import -<<<<<<< HEAD #import // get the associated view controller from a UIView // credits https://stackoverflow.com/questions/1372977/given-a-view-how-do-i-get-its-viewcontroller/24590678 #define UIViewParentController(__view) ({ UIResponder *__responder = __view; while ([__responder isKindOfClass:[UIView class]]) __responder = [__responder nextResponder]; (UIViewController *)__responder; }) -======= ->>>>>>> upstream/master @implementation CSColorDisplayCell @synthesize cellColorDisplay; @@ -38,16 +35,10 @@ - (void)refreshCellWithColor:(UIColor *)color { if (!color) { color = [self previewColor]; -<<<<<<< HEAD - } - -======= } else { - [self.specifier setProperty:color.cscp_hexStringWithAlpha forKey:@"hexValue"]; - [self.specifier setProperty:color forKey:@"color"]; - } - ->>>>>>> upstream/master + [self.specifier setProperty:color.cscp_hexStringWithAlpha forKey:@"hexValue"]; + [self.specifier setProperty:color forKey:@"color"]; + } self.cellColorDisplay.backgroundColor = color; self.detailTextLabel.text = [NSString stringWithFormat:@"#%@", [color cscp_hexString]]; } @@ -133,11 +124,7 @@ - (UIColor *)previewColor { hex = [self.specifier propertyForKey:@"fallback"] ? : @"FF0000"; } -<<<<<<< HEAD - color = [UIColor colorFromHexString:hex]; -======= - color = [UIColor cscp_colorFromHexString:hex]; ->>>>>>> upstream/master + color = [UIColor cscp_colorFromHexString:hex]; [self.specifier setProperty:hex forKey:@"hexValue"]; [self.specifier setProperty:color forKey:@"color"]; diff --git a/source/Cells/CSGradientDisplayCell.m b/source/Cells/CSGradientDisplayCell.m index dd9d612..1dfd1f4 100644 --- a/source/Cells/CSGradientDisplayCell.m +++ b/source/Cells/CSGradientDisplayCell.m @@ -5,6 +5,10 @@ #import +// get the associated view controller from a UIView +// credits https://stackoverflow.com/questions/1372977/given-a-view-how-do-i-get-its-viewcontroller/24590678 +#define UIViewParentController(__view) ({ UIResponder *__responder = __view; while ([__responder isKindOfClass:[UIView class]]) __responder = [__responder nextResponder]; (UIViewController *)__responder; }) + @implementation CSGradientDisplayCell @synthesize cellColorDisplay, gradient; @@ -27,7 +31,7 @@ - (void)refreshCellContentsWithSpecifier:(PSSpecifier *)specifier { } - (void)refreshCellWithColors:(NSArray *)newColors { - + if (!newColors) { newColors = [self previewColors]; } else { @@ -35,7 +39,7 @@ - (void)refreshCellWithColors:(NSArray *)newColors { [self.specifier setProperty:newColors.lastObject forKey:@"color"]; [self.specifier setProperty:newColors forKey:@"colors"]; } - + self.detailTextLabel.text = nil; NSMutableArray *colors = [NSMutableArray new]; for (UIColor *color in newColors) { @@ -69,13 +73,13 @@ - (void)configureColorDisplay { self.cellColorDisplay.layer.cornerRadius = CGRectGetHeight(self.cellColorDisplay.frame) / 4; self.cellColorDisplay.layer.borderWidth = 2; self.cellColorDisplay.layer.borderColor = [UIColor lightGrayColor].CGColor; - + self.gradient = [CAGradientLayer layer]; self.gradient.frame = self.cellColorDisplay.bounds; self.gradient.cornerRadius = self.cellColorDisplay.layer.cornerRadius; self.gradient.startPoint = CGPointMake(0, 0.5); self.gradient.endPoint = CGPointMake(1, 0.5); - + [self.cellColorDisplay.layer addSublayer:self.gradient]; [self setAccessoryView:self.cellColorDisplay]; } diff --git a/source/Controllers/CSColorPickerViewController.m b/source/Controllers/CSColorPickerViewController.m index 63e2d64..a65202d 100644 --- a/source/Controllers/CSColorPickerViewController.m +++ b/source/Controllers/CSColorPickerViewController.m @@ -5,11 +5,8 @@ #import -<<<<<<< HEAD #import -@implementation CSColorPickerViewController -======= #define SLIDER_HEIGHT 40.0 #define GRADIENT_HEIGHT 50.0 #define ALERT_TITLE @"Set Hex Color" @@ -22,7 +19,6 @@ @implementation CSColorPickerViewController @implementation CSColorPickerViewController { NSLayoutConstraint *_topConstraint; } ->>>>>>> upstream/master - (void)viewDidLoad { [super viewDidLoad]; @@ -207,9 +203,9 @@ - (void)setColor:(UIColor *)color animated:(BOOL)animated{ [self setColorInformationTextWithInformationFromColor:color]; }; - if (animated) + if (animated) [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ update(); } completion:nil]; - else + else update(); } @@ -217,7 +213,7 @@ - (void)setColorInformationTextWithInformationFromColor:(UIColor *)color { [self.colorInformationLable setText:[self informationStringForColor:color]]; UIColor *legibilityTint = (!color.cscp_light && color.cscp_alpha > 0.5) ? UIColor.whiteColor : UIColor.blackColor; UIColor *shadowColor = legibilityTint == UIColor.blackColor ? UIColor.whiteColor : UIColor.blackColor; - + [self.colorInformationLable setTextColor:legibilityTint]; [self.colorInformationLable.layer setShadowColor:[shadowColor CGColor]]; [self.colorInformationLable setFont:[UIFont boldSystemFontOfSize:[self isLandscape] ? 16 : 20]]; @@ -242,13 +238,9 @@ - (void)saveColor { NSString *plistPath = rPath([NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", defaults]); NSMutableDictionary *prefsDict = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath] ? : [NSMutableDictionary new]; -<<<<<<< HEAD - CSColorDisplayCell *cell = (CSColorDisplayCell *)[self.specifier propertyForKey:@"cellObject"]; -======= UITableViewCell *cell = [self.specifier propertyForKey:@"cellObject"]; - ->>>>>>> upstream/master + // save via plist [prefsDict setObject:saveValue forKey:key]; [prefsDict writeToFile:plistPath atomically:NO]; @@ -258,21 +250,13 @@ - (void)saveColor { CFPreferencesSynchronize((__bridge CFStringRef)defaults, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); // save in domain for NSUserDefaults -<<<<<<< HEAD - [[NSUserDefaults standardUserDefaults] setObject:color forKey:key inDomain:defaults]; - - if (cell) - [cell refreshCellWithColor:[self colorForRGBSliders]]; - -======= [[NSUserDefaults standardUserDefaults] setObject:saveValue forKey:key inDomain:defaults]; - + if (cell && [cell isKindOfClass:[CSColorDisplayCell class]]) [(CSColorDisplayCell *)cell refreshCellWithColor:[self colorForRGBSliders]]; else if (cell && [cell isKindOfClass:[CSGradientDisplayCell class]]) [(CSGradientDisplayCell *)cell refreshCellWithColors:self.colors]; - ->>>>>>> upstream/master + if ([self.specifier propertyForKey:@"PostNotification"]) CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)[self.specifier propertyForKey:@"PostNotification"], From 4f8a1050df3bf1ed87a66622b83298d44e09df41 Mon Sep 17 00:00:00 2001 From: opa334 Date: Thu, 29 Aug 2019 16:16:30 +0200 Subject: [PATCH 5/6] add beta simulator support --- install_simulator.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/install_simulator.sh b/install_simulator.sh index c658f24..d4001f1 100755 --- a/install_simulator.sh +++ b/install_simulator.sh @@ -30,3 +30,15 @@ if [ -d "$SIMULATOR_LIB_PATH" ]; then sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" fi + +#install libCSColorPicker into the simulator that ships with Xcode beta + +echo "Installing libCSColorPicker to /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime" + +BETA_SIMULATOR_ROOT=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot +BETA_SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib + +if [ -d "$BETA_SIMULATOR_LIB_PATH" ]; then + sudo rm -rf "$BETA_SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: + sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$BETA_SIMULATOR_LIB_PATH" +fi From 723d0817e529a00da23e9ba67d54b6d3d633bda2 Mon Sep 17 00:00:00 2001 From: opa334 Date: Tue, 3 Sep 2019 12:44:37 +0200 Subject: [PATCH 6/6] Fix installation into Xcode 11 simulator --- install_simulator.sh | 50 +++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/install_simulator.sh b/install_simulator.sh index d4001f1..3c0af49 100755 --- a/install_simulator.sh +++ b/install_simulator.sh @@ -8,37 +8,29 @@ THEOS_OBJ_DIR=./.theos/obj/iphone_simulator for runtime in /Library/Developer/CoreSimulator/Profiles/Runtimes/* do - echo "Installing libCSColorPicker to $runtime" - - SIMULATOR_ROOT=$runtime/Contents/Resources/RuntimeRoot - SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib - - if [ -d "$SIMULATOR_LIB_PATH" ]; then - sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: - sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" + if [ -d "$runtime" ]; then + echo "Installing libCSColorPicker to $runtime" + SIMULATOR_ROOT=$runtime/Contents/Resources/RuntimeRoot + SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib + + if [ -d "$SIMULATOR_LIB_PATH" ]; then + sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: + sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" + fi fi done #install libCSColorPicker into the simulator that ships with Xcode -echo "Installing libCSColorPicker to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime" - -SIMULATOR_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot -SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib - -if [ -d "$SIMULATOR_LIB_PATH" ]; then - sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: - sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" -fi - -#install libCSColorPicker into the simulator that ships with Xcode beta - -echo "Installing libCSColorPicker to /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime" - -BETA_SIMULATOR_ROOT=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot -BETA_SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib - -if [ -d "$BETA_SIMULATOR_LIB_PATH" ]; then - sudo rm -rf "$BETA_SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: - sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$BETA_SIMULATOR_LIB_PATH" -fi +for SIMULATOR_ROOT in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot +do + if [ -d "$SIMULATOR_ROOT" ]; then + echo "Installing libCSColorPicker to $SIMULATOR_ROOT" + SIMULATOR_LIB_PATH=$SIMULATOR_ROOT/usr/lib + + if [ -d "$SIMULATOR_LIB_PATH" ]; then + sudo rm -rf "$SIMULATOR_LIB_PATH/libCSColorPicker.dylib" ||: + sudo cp -rf "$THEOS_OBJ_DIR/libCSColorPicker.dylib" "$SIMULATOR_LIB_PATH" + fi + fi +done