From 764a76fd91f5f12584b4a2497ba409f122315a09 Mon Sep 17 00:00:00 2001 From: DoronZ Date: Thu, 24 Oct 2024 22:25:34 +0300 Subject: [PATCH] installation_proxy: make sure `/PublicStaging` exists on device --- pymobiledevice3/services/installation_proxy.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pymobiledevice3/services/installation_proxy.py b/pymobiledevice3/services/installation_proxy.py index b2be9412d..fc908ce34 100644 --- a/pymobiledevice3/services/installation_proxy.py +++ b/pymobiledevice3/services/installation_proxy.py @@ -14,9 +14,9 @@ GET_APPS_ADDITIONAL_INFO = {'ReturnAttributes': ['CFBundleIdentifier', 'StaticDiskUsage', 'DynamicDiskUsage']} -TEMP_REMOTE_IPA_FILE = '/PublicStaging/pymobiledevice3.ipa' - -TEMP_REMOTE_IPCC_FOLDER = '/PublicStaging/pymobiledevice3.ipcc' +TEMP_REMOTE_BASEDIR = '/PublicStaging' +TEMP_REMOTE_IPA_FILE = f'{TEMP_REMOTE_BASEDIR}/pymobiledevice3.ipa' +TEMP_REMOTE_IPCC_FOLDER = f'{TEMP_REMOTE_BASEDIR}/pymobiledevice3.ipcc' def create_ipa_contents_from_directory(directory: str) -> bytes: @@ -118,6 +118,7 @@ def install_from_local(self, package_path: Path, cmd: str = 'Install', options: with AfcService(self.lockdown) as afc: if not ipcc_mode: + afc.makedirs(TEMP_REMOTE_BASEDIR) afc.set_file_contents(TEMP_REMOTE_IPA_FILE, ipa_contents) else: @@ -147,7 +148,7 @@ def upload_ipcc_as_folder(self, file: Path, afc_client: AfcService) -> None: with file_zip.open(file_name) as inside_file_zip: file_data = inside_file_zip.read() - + afc_client.makedirs(TEMP_REMOTE_BASEDIR) afc_client.set_file_contents(f'{TEMP_REMOTE_IPCC_FOLDER}/{file_name}', file_data) self.logger.info('Upload complete.')