Skip to content

Commit

Permalink
Use local adb in portable builds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rom1v committed Dec 1, 2024
1 parent 8701ee9 commit b6a18e4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/adb/adb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b6a18e4

Please sign in to comment.