mirror of https://github.com/Genymobile/scrcpy
Use ADB environment variable
Use the ADB environment variable to provide a custom adb path.
This commit is contained in:
parent
865ebb3862
commit
628f88ab89
|
@ -6,10 +6,21 @@
|
||||||
|
|
||||||
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
#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) {
|
process_t adb_execute(const char *serial, const char *const adb_cmd[], int len) {
|
||||||
const char *cmd[len + 4];
|
const char *cmd[len + 4];
|
||||||
int i;
|
int i;
|
||||||
cmd[0] = "adb";
|
cmd[0] = get_adb_command();
|
||||||
if (serial) {
|
if (serial) {
|
||||||
cmd[1] = "-s";
|
cmd[1] = "-s";
|
||||||
cmd[2] = serial;
|
cmd[2] = serial;
|
||||||
|
|
Loading…
Reference in New Issue