From 60cf6780c399f71751b4748bcca84c41f1a0b722 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Aug 2012 00:17:40 +0200 Subject: Improve detection of Info.plist in application archive Some applications appear to provide another Info.plist. Using zip_name_locate() might locate the wrong one in such a case which prevented the correct installation of the application. --- src/ideviceinstaller.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 8f5ec5e..bde9d97 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c @@ -631,7 +631,24 @@ run_again: plist_t info = NULL; zbuf = NULL; len = 0; - if (zip_get_contents(zf, "Info.plist", ZIP_FL_NODIR, &zbuf, &len) < 0) { + char filename[256]; + + /* check for "Payload" directory */ + strcpy(filename, zip_get_name(zf, 0, 0)); + if (strcmp(filename, "Payload") != 0) { + fprintf(stderr, "Unable to locate Payload folder in archive!\n"); + zip_unchange_all(zf); + zip_close(zf); + goto leave_cleanup; + } + + /* check for "*.app" directory */ + strcpy(filename, zip_get_name(zf, 1, 0)); + + /* construct full filename to Info.plist */ + strcat(filename, "Info.plist"); + + if (zip_get_contents(zf, filename, 0, &zbuf, &len) < 0) { zip_unchange_all(zf); zip_close(zf); goto leave_cleanup; -- cgit v1.1-32-gdbae