Support paths containing spaces on Windows
Quote the arguments of "adb push" to support paths which contain spaces on Windows. Fixes <https://github.com/Genymobile/scrcpy/issues/288>.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include "str_util.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t xstrncpy(char *dest, const char *src, size_t n) {
|
||||
size_t i;
|
||||
for (i = 0; i < n - 1 && src[i] != '\0'; ++i)
|
||||
@@ -31,3 +34,16 @@ truncated:
|
||||
dst[n - 1] = '\0';
|
||||
return n;
|
||||
}
|
||||
|
||||
char *strquote(const char *src) {
|
||||
size_t len = strlen(src);
|
||||
char *quoted = malloc(len + 3);
|
||||
if (!quoted) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy("ed[1], src, len);
|
||||
quoted[0] = '"';
|
||||
quoted[len + 1] = '"';
|
||||
quoted[len + 2] = '\0';
|
||||
return quoted;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user