From 9e45cc0edb5a2a35c5b9050102efbd55ee871651 Mon Sep 17 00:00:00 2001 From: Incont Date: Fri, 15 May 2015 14:05:27 +0300 Subject: [PATCH] fixed not working --exists --- ios-deploy.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ios-deploy.c b/ios-deploy.c index 7fe11b0..8d4465b 100644 --- a/ios-deploy.c +++ b/ios-deploy.c @@ -1272,13 +1272,12 @@ void list_files(AMDeviceRef device) } } -int app_exists(AMDeviceRef device) +void app_exists(AMDeviceRef device) { if (bundle_id == NULL) { printf("Bundle id is not specified\n"); - return false; + return; } - AMDeviceConnect(device); assert(AMDeviceIsPaired(device)); assert(AMDeviceValidatePairing(device) == 0); @@ -1289,21 +1288,17 @@ int app_exists(AMDeviceRef device) NSArray *a = [NSArray arrayWithObjects:@"CFBundleIdentifier", nil]; NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"]; CFDictionaryRef options = (CFDictionaryRef)optionsDict; - CFDictionaryRef result = nil; afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result); assert(resultStatus == 0); CFDictionaryRef app_dict = CFDictionaryGetValue(result, cf_bundle_id); - - int appExists = (app_dict == NULL) ? -1 : 0; - + bool appExists = (app_dict == NULL) ? false : true; + printf("%s", appExists ? "true\n" : "false\n"); CFRelease(cf_bundle_id); assert(AMDeviceStopSession(device) == 0); assert(AMDeviceDisconnect(device) == 0); - - return appExists; } void copy_file_callback(afc_connection* afc_conn_p, const char *name,int file) @@ -1554,7 +1549,7 @@ void handle_device(AMDeviceRef device) { } else if (strcmp("rm", command) == 0) { remove_path(device); } else if (strcmp("exists", command) == 0) { - exit(app_exists(device)); + app_exists(device); } else if (strcmp("uninstall_only", command) == 0) { uninstall_app(device); }