summaryrefslogtreecommitdiffstats
path: root/src/installation_proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/installation_proxy.c')
-rw-r--r--src/installation_proxy.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index b7326dc..e4484ad 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -970,40 +970,22 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_get_path_for_bundle_iden
970 instproxy_client_options_add(client_opts, "ApplicationType", "Any", NULL); 970 instproxy_client_options_add(client_opts, "ApplicationType", "Any", NULL);
971 971
972 // only return attributes we need 972 // only return attributes we need
973 plist_t return_attributes = plist_new_array(); 973 instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", "Path", NULL);
974 plist_array_append_item(return_attributes, plist_new_string("CFBundleIdentifier")); 974
975 plist_array_append_item(return_attributes, plist_new_string("CFBundleExecutable")); 975 // only query for specific appid
976 plist_array_append_item(return_attributes, plist_new_string("Path")); 976 plist_t appid_node = plist_new_string(appid);
977 instproxy_client_options_add(client_opts, "ReturnAttributes", return_attributes, NULL);
978 plist_free(return_attributes);
979 return_attributes = NULL;
980 977
981 // query device for list of apps 978 // query device for list of apps
982 instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps); 979 instproxy_error_t ierr = instproxy_lookup(client, appid_node, client_opts, &apps);
980
981 plist_free(appid_node);
983 instproxy_client_options_free(client_opts); 982 instproxy_client_options_free(client_opts);
984 983
985 if (ierr != INSTPROXY_E_SUCCESS) { 984 if (ierr != INSTPROXY_E_SUCCESS) {
986 return ierr; 985 return ierr;
987 } 986 }
988 987
989 plist_t app_found = NULL; 988 plist_t app_found = plist_access_path(apps, 1, appid);
990 uint32_t i;
991 for (i = 0; i < plist_array_get_size(apps); i++) {
992 char *appid_str = NULL;
993 plist_t app_info = plist_array_get_item(apps, i);
994 plist_t idp = plist_dict_get_item(app_info, "CFBundleIdentifier");
995 if (idp) {
996 plist_get_string_val(idp, &appid_str);
997 }
998 if (appid_str && strcmp(appid, appid_str) == 0) {
999 app_found = app_info;
1000 }
1001 free(appid_str);
1002 if (app_found) {
1003 break;
1004 }
1005 }
1006
1007 if (!app_found) { 989 if (!app_found) {
1008 if (apps) 990 if (apps)
1009 plist_free(apps); 991 plist_free(apps);