Skip to content

Commit 928d4fe

Browse files
Print the installation path of the app bundle on the actual device after installation. Prints by default when using JSON output because new JSON fields are presumably backwards compatible and will be ignored by any existing parsing logic. Requires --verbose when not using JSON to maintain formaat of existing output. (#503)
1 parent 972a328 commit 928d4fe

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,17 @@ void handle_device(AMDeviceRef device) {
21452145
NSLogOut(@"------ Install phase ------");
21462146
NSLogOut(@"[ 0%%] Found %@ connected through %@, beginning install", device_full_name, device_interface_name);
21472147

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+
21482159
CFDictionaryRef options;
21492160
if (app_deltas == NULL) { // standard install
21502161
CFStringRef keys[] = { CFSTR("PackageType") };
@@ -2157,18 +2168,6 @@ void handle_device(AMDeviceRef device) {
21572168
check_error(AMDeviceStopSession(device));
21582169
check_error(AMDeviceDisconnect(device));
21592170
} 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-
21722171
CFStringRef deltas_path =
21732172
CFStringCreateWithCString(NULL, app_deltas, kCFStringEncodingUTF8);
21742173
CFURLRef deltas_relative_url =
@@ -2187,7 +2186,7 @@ void handle_device(AMDeviceRef device) {
21872186
CFSTR("ShadowParentKey"),
21882187
};
21892188
CFStringRef values[] = {
2190-
extracted_bundle_id,
2189+
install_bundle_id,
21912190
CFSTR("1"),
21922191
CFSTR("1"),
21932192
CFSTR("1"),
@@ -2201,7 +2200,6 @@ void handle_device(AMDeviceRef device) {
22012200

22022201
// Incremental installs should be done without a session started because of timeouts.
22032202
check_error(AMDeviceSecureInstallApplicationBundle(device, url, options, incremental_install_callback, 0));
2204-
CFRelease(extracted_bundle_id);
22052203
CFRelease(deltas_path);
22062204
CFRelease(deltas_relative_url);
22072205
CFRelease(app_deltas_url);
@@ -2211,12 +2209,24 @@ void handle_device(AMDeviceRef device) {
22112209

22122210
CFRelease(options);
22132211

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+
22142218
NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);
2219+
NSLogVerbose(@"App path: %@", device_app_path);
22152220
NSLogJSON(@{@"Event": @"BundleInstall",
22162221
@"OverallPercent": @(100),
22172222
@"Percent": @(100),
2218-
@"Status": @"Complete"
2223+
@"Status": @"Complete",
2224+
@"Path": (__bridge NSString *)device_app_path
22192225
});
2226+
2227+
CFRelease(device_app_url);
2228+
CFRelease(install_bundle_id);
2229+
CFRelease(device_app_path);
22202230
}
22212231
CFRelease(path);
22222232

0 commit comments

Comments
 (0)