@@ -2733,16 +2733,7 @@ void handle_device(AMDeviceRef device) {
2733
2733
NSLogOut (@" ------ Install phase ------" );
2734
2734
NSLogOut (@" [ 0%% ] Found %@ connected through %@ , beginning install" , device_full_name, device_interface_name);
2735
2735
2736
- CFStringRef install_bundle_id = NULL ;
2737
- if (bundle_id != NULL ) {
2738
- install_bundle_id = CFStringCreateWithCString (NULL , bundle_id, kCFStringEncodingUTF8 );
2739
- } else {
2740
- CFStringRef extracted_bundle_id = copy_bundle_id (url);
2741
- if (extracted_bundle_id == NULL ) {
2742
- on_error (@" [ ERROR] Could not determine bundle id." );
2743
- }
2744
- install_bundle_id = extracted_bundle_id;
2745
- }
2736
+ CFStringRef install_bundle_id = bundle_id == NULL ? copy_bundle_id (url) : CFStringCreateWithCString (NULL , bundle_id, kCFStringEncodingUTF8 );
2746
2737
2747
2738
CFDictionaryRef options;
2748
2739
if (app_deltas == NULL ) { // standard install
@@ -2756,6 +2747,9 @@ void handle_device(AMDeviceRef device) {
2756
2747
check_error (AMDeviceStopSession (device));
2757
2748
check_error (AMDeviceDisconnect (device));
2758
2749
} else { // incremental install
2750
+ if (install_bundle_id == NULL ) {
2751
+ on_error (@" [ ERROR] Could not determine bundle id." );
2752
+ }
2759
2753
CFStringRef deltas_path =
2760
2754
CFStringCreateWithCString (NULL , app_deltas, kCFStringEncodingUTF8 );
2761
2755
CFURLRef deltas_relative_url =
@@ -2797,24 +2791,32 @@ void handle_device(AMDeviceRef device) {
2797
2791
2798
2792
CFRelease (options);
2799
2793
2800
- connect_and_start_session (device);
2801
- CFURLRef device_app_url = copy_device_app_url (device, install_bundle_id);
2802
- check_error (AMDeviceStopSession (device));
2803
- check_error (AMDeviceDisconnect (device));
2804
- CFStringRef device_app_path = CFURLCopyFileSystemPath (device_app_url, kCFURLPOSIXPathStyle );
2805
-
2806
2794
NSLogOut (@" [100%% ] Installed package %@ " , [NSString stringWithUTF8String: app_path]);
2807
- NSLogVerbose (@" App path: %@ " , device_app_path);
2808
- NSLogJSON (@{@" Event" : @" BundleInstall" ,
2809
- @" OverallPercent" : @(100 ),
2810
- @" Percent" : @(100 ),
2811
- @" Status" : @" Complete" ,
2812
- @" Path" : (__bridge NSString *)device_app_path
2813
- });
2795
+ if (install_bundle_id == NULL ) {
2796
+ NSLogJSON (@{@" Event" : @" BundleInstall" ,
2797
+ @" OverallPercent" : @(100 ),
2798
+ @" Percent" : @(100 ),
2799
+ @" Status" : @" Complete"
2800
+ });
2801
+ } else {
2802
+ connect_and_start_session (device);
2803
+ CFURLRef device_app_url = copy_device_app_url (device, install_bundle_id);
2804
+ check_error (AMDeviceStopSession (device));
2805
+ check_error (AMDeviceDisconnect (device));
2806
+ CFStringRef device_app_path = CFURLCopyFileSystemPath (device_app_url, kCFURLPOSIXPathStyle );
2807
+
2808
+ NSLogVerbose (@" App path: %@ " , device_app_path);
2809
+ NSLogJSON (@{@" Event" : @" BundleInstall" ,
2810
+ @" OverallPercent" : @(100 ),
2811
+ @" Percent" : @(100 ),
2812
+ @" Status" : @" Complete" ,
2813
+ @" Path" : (__bridge NSString *)device_app_path
2814
+ });
2814
2815
2815
- CFRelease (device_app_url);
2816
- CFRelease (install_bundle_id);
2817
- CFRelease (device_app_path);
2816
+ CFRelease (device_app_url);
2817
+ CFRelease (install_bundle_id);
2818
+ CFRelease (device_app_path);
2819
+ }
2818
2820
}
2819
2821
CFRelease (path);
2820
2822
0 commit comments