(os: OS)
| 366 | } |
| 367 | |
| 368 | async function determineAndroidStudioPath(os: OS): Promise<string> { |
| 369 | if (process.env.CAPACITOR_ANDROID_STUDIO_PATH) { |
| 370 | return process.env.CAPACITOR_ANDROID_STUDIO_PATH; |
| 371 | } |
| 372 | |
| 373 | switch (os) { |
| 374 | case OS.Mac: |
| 375 | return '/Applications/Android Studio.app'; |
| 376 | case OS.Windows: { |
| 377 | const { runCommand } = await import('./util/subprocess'); |
| 378 | |
| 379 | let p = 'C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe'; |
| 380 | |
| 381 | try { |
| 382 | if (!(await pathExists(p))) { |
| 383 | let commandResult = await runCommand('REG', [ |
| 384 | 'QUERY', |
| 385 | 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio', |
| 386 | '/v', |
| 387 | 'Path', |
| 388 | ]); |
| 389 | commandResult = commandResult.replace(/(\r\n|\n|\r)/gm, ''); |
| 390 | const i = commandResult.indexOf('REG_SZ'); |
| 391 | if (i > 0) { |
| 392 | p = commandResult.substring(i + 6).trim() + '\\bin\\studio64.exe'; |
| 393 | } |
| 394 | } |
| 395 | } catch (e) { |
| 396 | debug(`Error checking registry for Android Studio path: %O`, e); |
| 397 | break; |
| 398 | } |
| 399 | |
| 400 | return p; |
| 401 | } |
| 402 | case OS.Linux: { |
| 403 | const studioExecPath = '/usr/local/android-studio/bin/studio'; |
| 404 | const studioShPath = '/usr/local/android-studio/bin/studio.sh'; |
| 405 | |
| 406 | try { |
| 407 | if (await pathExists(studioExecPath)) { |
| 408 | return studioExecPath; |
| 409 | } |
| 410 | } catch (e) { |
| 411 | debug(`Error checking for studio executable: %O`, e); |
| 412 | } |
| 413 | |
| 414 | return studioShPath; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | return ''; |
| 419 | } |
| 420 | |
| 421 | async function determineCocoapodPath(): Promise<string> { |
| 422 | if (process.env.CAPACITOR_COCOAPODS_PATH) { |
no test coverage detected