Skip to content

Commit e6f7777

Browse files
jaimecbernardogabebear
authored andcommitted
Use arch when looking for device support path (#441)
Uses the device CPU architecture value to look for DeviceSupport path.
1 parent b55ad12 commit e6f7777

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,16 @@ CFStringRef copy_device_support_path(AMDeviceRef device, CFStringRef suffix) {
468468
CFStringRef version = NULL;
469469
CFStringRef build = AMDeviceCopyValue(device, 0, CFSTR("BuildVersion"));
470470
CFStringRef deviceClass = AMDeviceCopyValue(device, 0, CFSTR("DeviceClass"));
471+
CFStringRef deviceModel = AMDeviceCopyValue(device, 0, CFSTR("HardwareModel"));
472+
CFStringRef deviceArch = NULL;
471473
CFStringRef path = NULL;
474+
475+
device_desc dev;
476+
if (deviceModel != NULL) {
477+
dev = get_device_desc(deviceModel);
478+
deviceArch = dev.arch;
479+
}
480+
472481
CFMutableArrayRef version_parts = copy_device_product_version_parts(device);
473482

474483
NSLogVerbose(@"Device Class: %@", deviceClass);
@@ -488,6 +497,12 @@ CFStringRef copy_device_support_path(AMDeviceRef device, CFStringRef suffix) {
488497
NSLogVerbose(@"version: %@", version);
489498

490499
for( int i = 0; i < 2; ++i ) {
500+
if (path == NULL) {
501+
CFStringRef search = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ (%@) %@/%@"), version, build, deviceArch, suffix);
502+
path = copy_xcode_path_for(deviceClassPath[i], search);
503+
CFRelease(search);
504+
}
505+
491506
if (path == NULL) {
492507
CFStringRef search = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ (%@)/%@"), version, build, suffix);
493508
path = copy_xcode_path_for(deviceClassPath[i], search);
@@ -531,6 +546,9 @@ CFStringRef copy_device_support_path(AMDeviceRef device, CFStringRef suffix) {
531546
CFRelease(version_parts);
532547
CFRelease(build);
533548
CFRelease(deviceClass);
549+
if (deviceModel != NULL) {
550+
CFRelease(deviceModel);
551+
}
534552
if (path == NULL) {
535553
NSString *msg = [NSString stringWithFormat:@"Unable to locate DeviceSupport directory with suffix '%@'. This probably means you don't have Xcode installed, you will need to launch the app manually and logging output will not be shown!", suffix];
536554
NSLogJSON(@{

0 commit comments

Comments
 (0)