Skip to content

Display and control your Android device

Use local adb in portable builds

Romain Vimont6d0ac3626dbc
diff --git a/app/src/adb/adb.c b/app/src/adb/adb.c
index 4bb209be..ce7cdec1 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;
}