From b6a18e492004315ed92912f93db95acdcf41e4bf Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 1 Dec 2024 15:48:50 +0100 Subject: [PATCH] Use local adb in portable builds For non-Windows portable builds, use the absolute path to the adb executable located in the same directory as scrcpy. On Windows, just use "adb", which is sufficient to use the local one. --- app/src/adb/adb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/adb/adb.c b/app/src/adb/adb.c index 4bb209bee6..ce7cdec120 100644 --- a/app/src/adb/adb.c +++ b/app/src/adb/adb.c @@ -34,11 +34,22 @@ sc_adb_init(void) { return true; } +#if !defined(PORTABLE) || defined(_WIN32) adb_executable = strdup("adb"); if (!adb_executable) { LOG_OOM(); return false; } +#else + // For portable builds, use the absolute path to the adb executable + // in the same directory as scrcpy (except on Windows, where "adb" + // is sufficient) + adb_executable = sc_file_get_local_path("adb"); + if (!adb_executable) { + // Error already logged + return false; + } +#endif return true; }