From 628f88ab897935f168a544a3b22a09d9a1b1a4a4 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 31 Jan 2018 18:46:56 +0100 Subject: [PATCH] Use ADB environment variable Use the ADB environment variable to provide a custom adb path. --- app/src/command.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/command.c b/app/src/command.c index 20387823..cd8b0a70 100644 --- a/app/src/command.c +++ b/app/src/command.c @@ -6,10 +6,21 @@ #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) +static const char *adb_command; + +static inline const char *get_adb_command() { + if (!adb_command) { + adb_command = getenv("ADB"); + if (!adb_command) + adb_command = "adb"; + } + return adb_command; +} + process_t adb_execute(const char *serial, const char *const adb_cmd[], int len) { const char *cmd[len + 4]; int i; - cmd[0] = "adb"; + cmd[0] = get_adb_command(); if (serial) { cmd[1] = "-s"; cmd[2] = serial;