From 36f12b567099196901456b0b723c5327a9ef2111 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 3 May 2016 17:58:44 +0000 Subject: [PATCH] Fix restarting when in folder with spaces. Quotes aren't allowed on my system. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3981 --- src/gui/sdlmain.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 43df32fb..33c07b21 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1802,7 +1802,18 @@ void restart_program(std::vector & parameters) { DEBUG_ShutDown(NULL); #endif - execvp(newargs[0], newargs); + if(execvp(newargs[0], newargs) == -1) { +#ifdef WIN32 + if(newargs[0][0] == '\"') { + //everything specifies quotes around it if it contains a space, however my system disagrees + std::string edit = parameters[0]; + edit.erase(0,1);edit.erase(edit.length() - 1,1); + //However keep the first argument of the passed argv (newargs) with quotes, as else repeated restarts go wrong. + if(execvp(edit.c_str(), newargs) == -1) E_Exit("Restarting failed"); + } +#endif + E_Exit("Restarting failed"); + } free(newargs); } void Restart(bool pressed) { // mapper handler