diff options
Diffstat (limited to 'src/installation_proxy.c')
-rw-r--r-- | src/installation_proxy.c | 34 |
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 instproxy_client_options_add(client_opts, "ApplicationType", "Any", NULL); // only return attributes we need - plist_t return_attributes = plist_new_array(); - plist_array_append_item(return_attributes, plist_new_string("CFBundleIdentifier")); - plist_array_append_item(return_attributes, plist_new_string("CFBundleExecutable")); - plist_array_append_item(return_attributes, plist_new_string("Path")); - instproxy_client_options_add(client_opts, "ReturnAttributes", return_attributes, NULL); - plist_free(return_attributes); - return_attributes = NULL; + instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", "Path", NULL); + + // only query for specific appid + plist_t appid_node = plist_new_string(appid); // query device for list of apps - instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps); + instproxy_error_t ierr = instproxy_lookup(client, appid_node, client_opts, &apps); + + plist_free(appid_node); instproxy_client_options_free(client_opts); if (ierr != INSTPROXY_E_SUCCESS) { return ierr; } - plist_t app_found = NULL; - uint32_t i; - for (i = 0; i < plist_array_get_size(apps); i++) { - char *appid_str = NULL; - plist_t app_info = plist_array_get_item(apps, i); - plist_t idp = plist_dict_get_item(app_info, "CFBundleIdentifier"); - if (idp) { - plist_get_string_val(idp, &appid_str); - } - if (appid_str && strcmp(appid, appid_str) == 0) { - app_found = app_info; - } - free(appid_str); - if (app_found) { - break; - } - } - + plist_t app_found = plist_access_path(apps, 1, appid); if (!app_found) { if (apps) plist_free(apps); |