Quote apk path on Windows

Windows will parse the string, so the local name must be quoted.
This commit is contained in:
Romain Vimont 2018-05-26 14:43:42 +02:00
parent e2a2973990
commit 9c6f9b24f9

View file

@ -73,6 +73,16 @@ process_t adb_push(const char *serial, const char *local, const char *remote) {
}
process_t adb_install(const char *serial, const char *local) {
#ifdef __WINDOWS__
// Windows will parse the string, so the local name must be quoted (see sys/win/command.c)
size_t len = strlen(local);
char quoted[len + 3];
memcpy(&quoted[1], local, len);
quoted[0] = '"';
quoted[len + 1] = '"';
quoted[len + 2] = '\0';
local = quoted;
#endif
const char *const adb_cmd[] = {"install", "-r", local};
return adb_execute(serial, adb_cmd, ARRAY_LEN(adb_cmd));
}