Fix for mismatched build numbers.
This commit is contained in:
parent
4aa233d147
commit
049a89e873
22
ios-deploy.c
22
ios-deploy.c
@ -187,10 +187,20 @@ Boolean path_exists(CFTypeRef path) {
|
|||||||
CFStringRef find_path(CFStringRef rootPath, CFStringRef namePattern, CFStringRef expression) {
|
CFStringRef find_path(CFStringRef rootPath, CFStringRef namePattern, CFStringRef expression) {
|
||||||
FILE *fpipe = NULL;
|
FILE *fpipe = NULL;
|
||||||
CFStringRef quotedRootPath = rootPath;
|
CFStringRef quotedRootPath = rootPath;
|
||||||
|
CFStringRef cf_command;
|
||||||
|
CFRange slashLocation;
|
||||||
|
|
||||||
if (CFStringGetCharacterAtIndex(rootPath, 0) != '`') {
|
if (CFStringGetCharacterAtIndex(rootPath, 0) != '`') {
|
||||||
quotedRootPath = CFStringCreateWithFormat(NULL, NULL, CFSTR("'%@'"), rootPath);
|
quotedRootPath = CFStringCreateWithFormat(NULL, NULL, CFSTR("'%@'"), rootPath);
|
||||||
}
|
}
|
||||||
CFStringRef cf_command = CFStringCreateWithFormat(NULL, NULL, CFSTR("find %@ -name '%@' %@ 2>/dev/null | sort | tail -n 1"), quotedRootPath, namePattern, expression);
|
|
||||||
|
slashLocation = CFStringFind(namePattern, CFSTR("/"), 0);
|
||||||
|
if (slashLocation.location == kCFNotFound) {
|
||||||
|
cf_command = CFStringCreateWithFormat(NULL, NULL, CFSTR("find %@ -name '%@' %@ 2>/dev/null | sort | tail -n 1"), quotedRootPath, namePattern, expression);
|
||||||
|
} else {
|
||||||
|
cf_command = CFStringCreateWithFormat(NULL, NULL, CFSTR("find %@ -path '%@' %@ 2>/dev/null | sort | tail -n 1"), quotedRootPath, namePattern, expression);
|
||||||
|
}
|
||||||
|
|
||||||
if (quotedRootPath != rootPath) {
|
if (quotedRootPath != rootPath) {
|
||||||
CFRelease(quotedRootPath);
|
CFRelease(quotedRootPath);
|
||||||
}
|
}
|
||||||
@ -255,6 +265,7 @@ CFStringRef copy_xcode_path_for(CFStringRef subPath, CFStringRef search) {
|
|||||||
CFStringRef path;
|
CFStringRef path;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
const char* home = get_home();
|
const char* home = get_home();
|
||||||
|
CFRange slashLocation;
|
||||||
|
|
||||||
|
|
||||||
// Try using xcode-select --print-path
|
// Try using xcode-select --print-path
|
||||||
@ -264,7 +275,12 @@ CFStringRef copy_xcode_path_for(CFStringRef subPath, CFStringRef search) {
|
|||||||
}
|
}
|
||||||
// Try find `xcode-select --print-path` with search as a name pattern
|
// Try find `xcode-select --print-path` with search as a name pattern
|
||||||
if (!found) {
|
if (!found) {
|
||||||
path = find_path(CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/%@"), xcodeDevPath, subPath), search, CFSTR("-maxdepth 1"));
|
slashLocation = CFStringFind(search, CFSTR("/"), 0);
|
||||||
|
if (slashLocation.location == kCFNotFound) {
|
||||||
|
path = find_path(CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/%@"), xcodeDevPath, subPath), search, CFSTR("-maxdepth 1"));
|
||||||
|
} else {
|
||||||
|
path = find_path(CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/%@"), xcodeDevPath, subPath), search, CFSTR(""));
|
||||||
|
}
|
||||||
found = CFStringGetLength(path) > 0 && path_exists(path);
|
found = CFStringGetLength(path) > 0 && path_exists(path);
|
||||||
}
|
}
|
||||||
// If not look in the default xcode location (xcode-select is sometimes wrong)
|
// If not look in the default xcode location (xcode-select is sometimes wrong)
|
||||||
@ -473,7 +489,7 @@ CFStringRef copy_developer_disk_image_path(AMDeviceRef device) {
|
|||||||
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ (%@)/DeveloperDiskImage.dmg"), version, build));
|
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ (%@)/DeveloperDiskImage.dmg"), version, build));
|
||||||
}
|
}
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("%@ (*)/DeveloperDiskImage.dmg"), version));
|
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("*/%@ (*)/DeveloperDiskImage.dmg"), version));
|
||||||
}
|
}
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/DeveloperDiskImage.dmg"), version));
|
path = copy_xcode_path_for(CFSTR("Platforms/iPhoneOS.platform/DeviceSupport"), CFStringCreateWithFormat(NULL, NULL, CFSTR("%@/DeveloperDiskImage.dmg"), version));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user