Updater: Fix updating mGBA from a path with spaces on Windows

This commit is contained in:
Vicki Pfau 2022-02-11 20:30:38 -08:00
parent 6b48b53356
commit 9cfa7120b1
1 changed files with 5 additions and 1 deletions

View File

@ -213,10 +213,14 @@ int main(int argc, char* argv[]) {
}
mCoreConfigDeinit(&config);
if (ok == 0) {
const char* argv[] = { bin, NULL };
#ifdef _WIN32
char qbin[PATH_MAX + 2] = {0};
// Windows is a bad operating system
snprintf(qbin, sizeof(qbin), "\"%s\"", bin);
const char* argv[] = { qbin, NULL };
_execv(bin, argv);
#elif defined(_POSIX_C_SOURCE) || defined(__APPLE__)
const char* argv[] = { bin, NULL };
execv(bin, argv);
#endif
}