mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Improve portable builds
In portable builds, scrcpy-server.jar was supposed to be present in the current directory, so in practice it worked only if scrcpy was launched from its own directory. Instead, find the absolute path of the executable and build a suitable path to use scrcpy-server.jar from the same directory.
This commit is contained in:
parent
3b17ff7c86
commit
2755bfc255
6 changed files with 95 additions and 12 deletions
|
|
@ -75,3 +75,18 @@ cmd_simple_wait(HANDLE handle, DWORD *exit_code) {
|
|||
}
|
||||
return !code;
|
||||
}
|
||||
|
||||
char *
|
||||
get_executable_path(void) {
|
||||
HMODULE hModule = GetModuleHandleW(NULL);
|
||||
if (!hModule) {
|
||||
return NULL;
|
||||
}
|
||||
WCHAR buf[MAX_PATH + 1]; // +1 for the null byte
|
||||
int len = GetModuleFileNameW(hModule, buf, MAX_PATH);
|
||||
if (!len) {
|
||||
return NULL;
|
||||
}
|
||||
buf[len] = '\0';
|
||||
return utf8_from_wide_char(buf);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue