@@ -2145,6 +2145,17 @@ void handle_device(AMDeviceRef device) {
2145
2145
NSLogOut (@" ------ Install phase ------" );
2146
2146
NSLogOut (@" [ 0%% ] Found %@ connected through %@ , beginning install" , device_full_name, device_interface_name);
2147
2147
2148
+ CFStringRef install_bundle_id = NULL ;
2149
+ if (bundle_id != NULL ) {
2150
+ install_bundle_id = CFStringCreateWithCString (NULL , bundle_id, kCFStringEncodingUTF8 );
2151
+ } else {
2152
+ CFStringRef extracted_bundle_id = copy_bundle_id (url);
2153
+ if (extracted_bundle_id == NULL ) {
2154
+ on_error (@" [ ERROR] Could not determine bundle id." );
2155
+ }
2156
+ install_bundle_id = extracted_bundle_id;
2157
+ }
2158
+
2148
2159
CFDictionaryRef options;
2149
2160
if (app_deltas == NULL ) { // standard install
2150
2161
CFStringRef keys[] = { CFSTR (" PackageType" ) };
@@ -2157,18 +2168,6 @@ void handle_device(AMDeviceRef device) {
2157
2168
check_error (AMDeviceStopSession (device));
2158
2169
check_error (AMDeviceDisconnect (device));
2159
2170
} else { // incremental install
2160
- CFStringRef extracted_bundle_id = NULL ;
2161
- CFStringRef extracted_bundle_id_ref = copy_bundle_id (url);
2162
- if (bundle_id != NULL ) {
2163
- extracted_bundle_id = CFStringCreateWithCString (NULL , bundle_id, kCFStringEncodingUTF8 );
2164
- CFRelease (extracted_bundle_id_ref);
2165
- } else {
2166
- if (extracted_bundle_id_ref == NULL ) {
2167
- on_error (@" [ ERROR] Could not determine bundle id." );
2168
- }
2169
- extracted_bundle_id = extracted_bundle_id_ref;
2170
- }
2171
-
2172
2171
CFStringRef deltas_path =
2173
2172
CFStringCreateWithCString (NULL , app_deltas, kCFStringEncodingUTF8 );
2174
2173
CFURLRef deltas_relative_url =
@@ -2187,7 +2186,7 @@ void handle_device(AMDeviceRef device) {
2187
2186
CFSTR (" ShadowParentKey" ),
2188
2187
};
2189
2188
CFStringRef values[] = {
2190
- extracted_bundle_id ,
2189
+ install_bundle_id ,
2191
2190
CFSTR (" 1" ),
2192
2191
CFSTR (" 1" ),
2193
2192
CFSTR (" 1" ),
@@ -2201,7 +2200,6 @@ void handle_device(AMDeviceRef device) {
2201
2200
2202
2201
// Incremental installs should be done without a session started because of timeouts.
2203
2202
check_error (AMDeviceSecureInstallApplicationBundle (device, url, options, incremental_install_callback, 0 ));
2204
- CFRelease (extracted_bundle_id);
2205
2203
CFRelease (deltas_path);
2206
2204
CFRelease (deltas_relative_url);
2207
2205
CFRelease (app_deltas_url);
@@ -2211,12 +2209,24 @@ void handle_device(AMDeviceRef device) {
2211
2209
2212
2210
CFRelease (options);
2213
2211
2212
+ connect_and_start_session (device);
2213
+ CFURLRef device_app_url = copy_device_app_url (device, install_bundle_id);
2214
+ check_error (AMDeviceStopSession (device));
2215
+ check_error (AMDeviceDisconnect (device));
2216
+ CFStringRef device_app_path = CFURLCopyFileSystemPath (device_app_url, kCFURLPOSIXPathStyle );
2217
+
2214
2218
NSLogOut (@" [100%% ] Installed package %@ " , [NSString stringWithUTF8String: app_path]);
2219
+ NSLogVerbose (@" App path: %@ " , device_app_path);
2215
2220
NSLogJSON (@{@" Event" : @" BundleInstall" ,
2216
2221
@" OverallPercent" : @(100 ),
2217
2222
@" Percent" : @(100 ),
2218
- @" Status" : @" Complete"
2223
+ @" Status" : @" Complete" ,
2224
+ @" Path" : (__bridge NSString *)device_app_path
2219
2225
});
2226
+
2227
+ CFRelease (device_app_url);
2228
+ CFRelease (install_bundle_id);
2229
+ CFRelease (device_app_path);
2220
2230
}
2221
2231
CFRelease (path);
2222
2232
0 commit comments