Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/android/adb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ export function runAndroidLoggingProcess(adbPath?: string): ChildProcess {
return spawnLogcatProcess(execPath);
}

export function getSdkRoot(): string | undefined {
return process.env.ANDROID_SDK_ROOT ?? process.env.ANDROID_HOME;
}

export function getAdbPath(customPath?: string): string {
if (customPath) {
return path.resolve(customPath);
}

return process.env.ANDROID_HOME
? `${process.env.ANDROID_HOME}/platform-tools/adb`
: 'adb';
const sdkRoot = getSdkRoot();
return sdkRoot ? `${sdkRoot}/platform-tools/adb` : 'adb';
}

export function spawnLogcatProcess(adbPath: string): ChildProcess {
Expand Down