From 02fff36082103a8d51fa9096c74694eca057be75 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sun, 21 Oct 2012 17:03:42 +0200 Subject: Use CFBundleExecutable instead of CFBundleName to construct executable path Apparently some app archives might miss the CFBundleName key in the Info.plist. This caused ideviceinstaller to fail. The correct key to use is CFBundleExecutable which is apparently also used by the device itself to construct the right path. This should fix compatibility with some app archives. --- src/ideviceinstaller.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 1d3f383..79961e1 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c @@ -633,7 +633,6 @@ run_again: free(zbuf); } - /* we need to get the CFBundleName first */ plist_t info = NULL; zbuf = NULL; len = 0; @@ -693,27 +692,27 @@ run_again: goto leave_cleanup; } - char *bundlename = NULL; + char *bundleexecutable = NULL; - plist_t bname = plist_dict_get_item(info, "CFBundleName"); + plist_t bname = plist_dict_get_item(info, "CFBundleExecutable"); if (bname) { - plist_get_string_val(bname, &bundlename); + plist_get_string_val(bname, &bundleexecutable); } plist_free(info); - if (!bundlename) { - fprintf(stderr, "Could not determine CFBundleName!\n"); + if (!bundleexecutable) { + fprintf(stderr, "Could not determine value for CFBundleExecutable!\n"); zip_unchange_all(zf); zip_close(zf); goto leave_cleanup; } char *sinfname = NULL; - if (asprintf(&sinfname, "Payload/%s.app/SC_Info/%s.sinf", bundlename, bundlename) < 0) { + if (asprintf(&sinfname, "Payload/%s.app/SC_Info/%s.sinf", bundleexecutable, bundleexecutable) < 0) { fprintf(stderr, "Out of memory!?\n"); goto leave_cleanup; } - free(bundlename); + free(bundleexecutable); /* extract .sinf from package */ zbuf = NULL; -- cgit v1.1-32-gdbae