From dad8f3b9ecf5794f1b3c539878f91ee106d28448 Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 2 Jan 2021 02:44:32 +0100 Subject: quote executable/script path to not deal with whitespace problems --- src/wine.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/wine.c') diff --git a/src/wine.c b/src/wine.c index c8680d0..d067ca6 100644 --- a/src/wine.c +++ b/src/wine.c @@ -233,6 +233,15 @@ COMMAND(wine, run) if (isFile(winepath)) { + // quote the winepath so whitespace won't cause trouble + { + char winepathcpy[PATH_MAX] = {0}; + strncat(winepathcpy, "\"", sizeof(winepathcpy) - strlen(winepathcpy) - 1); + strncat(winepathcpy, winepath, sizeof(winepathcpy) - strlen(winepathcpy) - 1); + strncat(winepathcpy, "\"", sizeof(winepathcpy) - strlen(winepathcpy) - 1); + strncpy(winepath, winepathcpy, sizeof(winepathcpy)); + } + for (int i = 2; i < argc; ++i) { // make sure the passed arguments are in quotes so spaces don't cause problems -- cgit v1.2.3