Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/iPhoneSimulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
BOOL alreadyPrintedData;
BOOL retinaDevice;
BOOL tallDevice;
BOOL is64BitDevice;
}

- (void)runWithArgc:(int)argc argv:(char **)argv;
Expand Down
28 changes: 20 additions & 8 deletions Source/iPhoneSimulator.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ -(void) LoadSimulatorFramework:(NSString*) developerDir {
NSString* developerDir = [env objectForKey:@"DEVELOPER_DIR"];
if ([developerDir length] > 0)
return developerDir;

// Go look for it via xcode-select.
NSTask* xcodeSelectTask = [[[NSTask alloc] init] autorelease];
[xcodeSelectTask setLaunchPath:@"/usr/bin/xcode-select"];
[xcodeSelectTask setArguments:[NSArray arrayWithObject:@"-print-path"]];

NSPipe* outputPipe = [NSPipe pipe];
[xcodeSelectTask setStandardOutput:outputPipe];
NSFileHandle* outputFile = [outputPipe fileHandleForReading];

[xcodeSelectTask launch];
NSData* outputData = [outputFile readDataToEndOfFile];
[xcodeSelectTask terminate];

NSString* output =
[[[NSString alloc] initWithData:outputData
encoding:NSUTF8StringEncoding] autorelease];
Expand Down Expand Up @@ -135,6 +135,7 @@ - (void) printUsage {
fprintf(stderr, " --family <device family> The device type that should be simulated (defaults to `iphone')\n");
fprintf(stderr, " --retina Start a retina device\n");
fprintf(stderr, " --tall In combination with --retina flag, start the tall version of the retina device (e.g. iPhone 5 (4-inch))\n");
fprintf(stderr, " --64bit In combination with --retina flag and the --tall flag, start the 64bit version of the tall retina device (e.g. iPhone 5S (4-inch 64bit))\n");
fprintf(stderr, " --uuid <uuid> A UUID identifying the session (is that correct?)\n");
fprintf(stderr, " --env <environment file path> A plist file containing environment key-value pairs that should be set\n");
fprintf(stderr, " --setenv NAME=VALUE Set an environment variable\n");
Expand Down Expand Up @@ -343,8 +344,8 @@ - (int)launchApp:(NSString *)path withFamily:(NSString *)family
[config setSimulatedDeviceFamily:[NSNumber numberWithInt:1]];
}
}
NSString* devicePropertyValue = [self changeDeviceType:family retina:retinaDevice isTallDevice:tallDevice];

NSString* devicePropertyValue = [self changeDeviceType:family retina:retinaDevice isTallDevice:tallDevice is64Bit:is64BitDevice];
[config setSimulatedDeviceInfoName:devicePropertyValue];

/* Start the session */
Expand All @@ -362,18 +363,26 @@ - (int)launchApp:(NSString *)path withFamily:(NSString *)family
return EXIT_SUCCESS;
}

- (NSString*) changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice {
- (NSString*) changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice is64Bit:(BOOL)is64Bit {
NSString *devicePropertyValue;
if (retina) {
if (verbose) {
nsprintf(@"using retina");
}
if ([family isEqualToString:@"ipad"]) {
devicePropertyValue = deviceIpadRetina;
if (is64Bit) {
devicePropertyValue = deviceIpadRetina_64bit;
} else {
devicePropertyValue = deviceIpadRetina;
}
}
else {
if (isTallDevice) {
if (is64Bit) {
devicePropertyValue = deviceIphoneRetina4_0Inch_64bit;
} else {
devicePropertyValue = deviceIphoneRetina4_0Inch;
}
} else {
devicePropertyValue = deviceIphoneRetina3_5Inch;
}
Expand Down Expand Up @@ -403,6 +412,7 @@ - (void)runWithArgc:(int)argc argv:(char **)argv {

retinaDevice = NO;
tallDevice = NO;
is64BitDevice = NO;
exitOnStartup = NO;
alreadyPrintedData = NO;
startOnly = strcmp(argv[1], "start") == 0;
Expand Down Expand Up @@ -516,6 +526,8 @@ - (void)runWithArgc:(int)argc argv:(char **)argv {
retinaDevice = YES;
} else if (strcmp(argv[i], "--tall") == 0) {
tallDevice = YES;
} else if (strcmp(argv[i], "--64bit") == 0) {
is64BitDevice = YES;
} else if (strcmp(argv[i], "--args") == 0) {
i++;
break;
Expand Down