Skip to content

Commit 40dafdf

Browse files
committed
backend/launcher: don't try to pass empty string as additional argument if falsy (empty, null, ...)
If the additional command line arguments are unset/set to an empty string, the sideload command launcher likewise used to pass an empty argument to the launched application. While that is usually harmless, some applications try to parse this argument and (rightfully) complain and usually exit with an error. Make sure that we only pass additional arguments if they are actually set, fixing that issue. This has been encountered with Palia's launcher. While at it, also fix a log line by including additional arguments and a typo in a comment.
1 parent 76e63a9 commit 40dafdf

File tree

1 file changed

+7
-6
lines changed
  • src/backend/storeManagers/storeManagerCommon

1 file changed

+7
-6
lines changed

src/backend/storeManagers/storeManagerCommon/games.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ export async function launchGame(
151151

152152
const gameSettings = await getAppSettings(appName)
153153
const { launcherArgs } = gameSettings
154+
const extraArgs = shlex.split(launcherArgs ?? '')
155+
const extraArgsJoined = extraArgs.join(' ')
154156

155157
if (executable) {
156158
const isNative = gameManagerMap[runner].isNative(appName)
@@ -196,15 +198,15 @@ export async function launchGame(
196198
// Native
197199
if (isNative) {
198200
logInfo(
199-
`launching native sideloaded game: ${executable} ${launcherArgs ?? ''}`,
201+
`launching native sideloaded game: ${executable} ${extraArgsJoined}`,
200202
LogPrefix.Backend
201203
)
202204

203205
try {
204206
await access(executable, FS_CONSTANTS.X_OK)
205207
} catch (error) {
206208
logWarning(
207-
'File not executable, changing permissions temporarilly',
209+
'File not executable, changing permissions temporarily',
208210
LogPrefix.Backend
209211
)
210212
// On Mac, it gives an error when changing the permissions of the file inside the app bundle. But we need it for other executables like scripts.
@@ -213,15 +215,14 @@ export async function launchGame(
213215
}
214216
}
215217

216-
const commandParts = shlex.split(launcherArgs ?? '')
217218
const env = {
218219
...process.env,
219220
...setupWrapperEnvVars({ appName, appRunner: runner }),
220221
...setupEnvVars(gameSettings, gameInfo.install.install_path)
221222
}
222223

223224
await callRunner(
224-
commandParts,
225+
extraArgs,
225226
{
226227
name: runner,
227228
logPrefix: LogPrefix.Backend,
@@ -245,12 +246,12 @@ export async function launchGame(
245246
}
246247

247248
logInfo(
248-
`launching non-native sideloaded: ${executable}}`,
249+
`launching non-native sideloaded: ${executable} ${extraArgsJoined}`,
249250
LogPrefix.Backend
250251
)
251252

252253
await runWineCommand({
253-
commandParts: [executable, launcherArgs ?? ''],
254+
commandParts: [executable, ...extraArgs],
254255
gameSettings,
255256
wait: true,
256257
protonVerb: 'waitforexitandrun',

0 commit comments

Comments
 (0)