diff --git a/Makefile b/Makefile index 3176052..33c42bf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ IOS_CC = gcc -IOS_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk +IOS_SDK = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk +DEVICE_SUPPORT = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/DeviceSupport all: clean ios-deploy @@ -15,7 +16,10 @@ demo: demo.c ios-deploy: ios-deploy.c $(IOS_CC) -o ios-deploy -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c -install: ios-deploy +symlink: + cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest + +install: symlink ios-deploy mkdir -p $(prefix)/bin cp ios-deploy $(prefix)/bin diff --git a/ios-deploy.c b/ios-deploy.c index 7c50da7..c82dde0 100644 --- a/ios-deploy.c +++ b/ios-deploy.c @@ -95,7 +95,7 @@ CFStringRef copy_device_support_path(AMDeviceRef device) { } if (!found) { - path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version); + path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest")); found = path_exists(path); } @@ -123,7 +123,7 @@ CFStringRef copy_developer_disk_image_path(AMDeviceRef device) { found = path_exists(path); if (!found) { - path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@/DeveloperDiskImage.dmg)"), version, build); + path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)/DeveloperDiskImage.dmg)"), version, build); found = path_exists(path); } if (!found) { @@ -142,6 +142,11 @@ CFStringRef copy_developer_disk_image_path(AMDeviceRef device) { path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/DeveloperDiskImage.dmg")); found = path_exists(path); } + if (!found) + { + path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest/DeveloperDiskImage.dmg")); + found = path_exists(path); + } CFRelease(version); CFRelease(build);