From 4f0837fb3e981dc51778056d9d7b83d12d10220c Mon Sep 17 00:00:00 2001 From: Benjamin Altpeter Date: Sun, 16 Apr 2023 22:17:05 +0200 Subject: [PATCH] Windows-specific ideviceinstaller commands --- docs/README.md | 4 ++-- src/ios.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index 34242bb..b731220 100644 --- a/docs/README.md +++ b/docs/README.md @@ -89,7 +89,7 @@ An ID of a known permission on iOS. #### Defined in -[ios.ts:377](https://github.com/tweaselORG/appstraction/blob/main/src/ios.ts#L377) +[ios.ts:382](https://github.com/tweaselORG/appstraction/blob/main/src/ios.ts#L382) ___ @@ -286,7 +286,7 @@ The IDs of known permissions on iOS. #### Defined in -[ios.ts:360](https://github.com/tweaselORG/appstraction/blob/main/src/ios.ts#L360) +[ios.ts:365](https://github.com/tweaselORG/appstraction/blob/main/src/ios.ts#L365) ## Functions diff --git a/src/ios.ts b/src/ios.ts index fd63457..af15d41 100644 --- a/src/ios.ts +++ b/src/ios.ts @@ -164,7 +164,10 @@ export const iosApi = >( clearStuckModals: asyncUnimplemented('clearStuckModals') as never, isAppInstalled: async (appId) => { - const { stdout } = await execa('ideviceinstaller', ['-l', '-o', 'list_all']); + const { stdout } = + process.platform === 'win32' + ? await execa('ideviceinstaller', ['-l', '-o', 'list_all']) + : await execa('ideviceinstaller', ['list', '-o', 'list_all']); return ( stdout .split('\n') @@ -176,10 +179,12 @@ export const iosApi = >( // We're using `libimobiledevice` instead of `cfgutil` because the latter doesn't wait for the app to be fully // installed before exiting. installApp: async (ipaPath) => { - await execa('ideviceinstaller', ['--install', ipaPath]); + if (process.platform === 'win32') await execa('ideviceinstaller', ['install', ipaPath]); + else await execa('ideviceinstaller', ['--install', ipaPath]); }, uninstallApp: async (appId) => { - await execa('ideviceinstaller', ['--uninstall', appId]); + if (process.platform === 'win32') await execa('ideviceinstaller', ['uninstall', appId]); + else await execa('ideviceinstaller', ['--uninstall', appId]); }, async setAppPermissions(appId, _permissions) { if (!options.capabilities.includes('ssh') || !options.capabilities.includes('frida'))