From 5385b8b3a54607d0fe58b689c5e8a9df756e4f38 Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Wed, 4 May 2022 15:31:57 +0200 Subject: [PATCH] adjust command on windows to allow for spaces in solver path --- src/amplsolver/amplsolver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amplsolver/amplsolver.c b/src/amplsolver/amplsolver.c index 7c34712e..a150a8b4 100644 --- a/src/amplsolver/amplsolver.c +++ b/src/amplsolver/amplsolver.c @@ -271,8 +271,8 @@ int runSolver( #ifndef _WIN32 if( snprintf(command, sizeof(command), "\"%s\" \"%s\" -AMPL 2>&1", as->solver, as->filename) >= sizeof(command) ) #else - /* windows doesn't seem to like quotes around the executable name */ - if( snprintf(command, sizeof(command), "%s \"%s\" -AMPL 2>&1", as->solver, as->filename) >= sizeof(command) ) + /* windows accepts quotes around exe only if everything is quoted again */ + if( snprintf(command, sizeof(command), "\"\"%s\" \"%s\" -AMPL 2>&1\"", as->solver, as->filename) >= sizeof(command) ) #endif { /* with GAMS' limit on GMS_SSSIZE for option values and scratch dirname, this shouldn't happen */