summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2015-01-26 23:38:47 +0100
committerGravatar Martin Szulecki2015-01-27 22:01:23 +0100
commitd44af054c88ffc2aa1baeee609fa6e704afb2b77 (patch)
tree229d888d2cee32fd8b359fcb19b94589d283e9e2 /src
parent9d7667a1ace1da60f508fa075793bba87e98af4a (diff)
downloadlibimobiledevice-d44af054c88ffc2aa1baeee609fa6e704afb2b77.tar.gz
libimobiledevice-d44af054c88ffc2aa1baeee609fa6e704afb2b77.tar.bz2
installation_proxy: Use new lookup command for app path retrieval helper
Diffstat (limited to 'src')
-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
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);