diff --git a/electron/launcher.ts b/electron/launcher.ts index aa651a9839..a76052202e 100644 --- a/electron/launcher.ts +++ b/electron/launcher.ts @@ -616,7 +616,7 @@ function getLegendaryOrGogdlCommand( continue } } - formattedEnvVars.push(`${key}=${value}`) + formattedEnvVars.push(`${key}=${quoteIfNecessary(value)}`) } return [ diff --git a/electron/utils.ts b/electron/utils.ts index 51c6c77987..295f9778db 100644 --- a/electron/utils.ts +++ b/electron/utils.ts @@ -543,7 +543,11 @@ const formatEpicStoreUrl = (title: string) => { } function quoteIfNecessary(stringToQuote: string) { - if (stringToQuote.includes(' ')) { + if ( + (stringToQuote.charAt(0) !== '"' || + stringToQuote.charAt(stringToQuote.length - 1) !== '"') && + stringToQuote.includes(' ') + ) { return `"${stringToQuote}"` } return stringToQuote