Skip to content

Commit

Permalink
Merge pull request #145 from paventuri/devicetypeid_prefix_optional
Browse files Browse the repository at this point in the history
added prefix com.apple.CoreSimulator.SimDeviceType. for --devicetypeid a...
  • Loading branch information
shazron committed Apr 23, 2015
2 parents 890e272 + e1632e4 commit 4a55127
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/iPhoneSimulator.m
Expand Up @@ -22,6 +22,7 @@
NSString *deviceIpadRetina = @"iPad Retina";
NSString *deviceIpadRetina_64bit = @"iPad Retina (64-bit)";

NSString* deviceTypeIdPrefix = @"com.apple.CoreSimulator.SimDeviceType.";
NSString* deviceTypeIdIphone4s = @"com.apple.CoreSimulator.SimDeviceType.iPhone-4s";
NSString* deviceTypeIdIphone5 = @"com.apple.CoreSimulator.SimDeviceType.iPhone-5";
NSString* deviceTypeIdIphone5s = @"com.apple.CoreSimulator.SimDeviceType.iPhone-5s";
Expand Down Expand Up @@ -231,7 +232,7 @@ - (int) showDeviceTypes {
SimDeviceSet* deviceSet = [simDeviceSet defaultSet];
NSArray* devices = [deviceSet availableDevices];
for (SimDevice* device in devices) {
nsfprintf(stdout, @"%@, %@", device.deviceType.identifier, device.runtime.versionString);
nsfprintf(stdout, @"%@,%@", [device.deviceType.identifier substringFromIndex:[device.deviceType.identifier rangeOfString:deviceTypeIdPrefix].length], device.runtime.versionString);
}
}

Expand Down Expand Up @@ -699,6 +700,9 @@ - (void)runWithArgc:(int)argc argv:(char **)argv {
} else if (strcmp(argv[i], "--devicetypeid") == 0) {
i++;
deviceTypeId = [NSString stringWithUTF8String:argv[i]];
if (![deviceTypeId containsString:deviceTypeIdPrefix]) {
deviceTypeId = [deviceTypeIdPrefix stringByAppendingString:deviceTypeId];
}
} else if (strcmp(argv[i], "--setenv") == 0) {
i++;
NSArray *parts = [[NSString stringWithUTF8String:argv[i]] componentsSeparatedByString:@"="];
Expand Down

0 comments on commit 4a55127

Please sign in to comment.