Skip to content

[Tech] Skip empty arguments in sideload and frontend command launcher #3009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/backend/storeManagers/storeManagerCommon/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export async function launchGame(

const gameSettings = await getAppSettings(appName)
const { launcherArgs } = gameSettings
const extraArgs = shlex.split(launcherArgs ?? '')
const extraArgsJoined = extraArgs.join(' ')

if (executable) {
const isNative = gameManagerMap[runner].isNative(appName)
Expand Down Expand Up @@ -196,15 +198,15 @@ export async function launchGame(
// Native
if (isNative) {
logInfo(
`launching native sideloaded game: ${executable} ${launcherArgs ?? ''}`,
`launching native sideloaded game: ${executable} ${extraArgsJoined}`,
LogPrefix.Backend
)

try {
await access(executable, FS_CONSTANTS.X_OK)
} catch (error) {
logWarning(
'File not executable, changing permissions temporarilly',
'File not executable, changing permissions temporarily',
LogPrefix.Backend
)
// 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.
Expand All @@ -213,15 +215,14 @@ export async function launchGame(
}
}

const commandParts = shlex.split(launcherArgs ?? '')
const env = {
...process.env,
...setupWrapperEnvVars({ appName, appRunner: runner }),
...setupEnvVars(gameSettings, gameInfo.install.install_path)
}

await callRunner(
commandParts,
extraArgs,
{
name: runner,
logPrefix: LogPrefix.Backend,
Expand All @@ -245,12 +246,12 @@ export async function launchGame(
}

logInfo(
`launching non-native sideloaded: ${executable}}`,
`launching non-native sideloaded: ${executable} ${extraArgsJoined}`,
LogPrefix.Backend
)

await runWineCommand({
commandParts: [executable, launcherArgs ?? ''],
commandParts: [executable, ...extraArgs],
gameSettings,
wait: true,
protonVerb: 'waitforexitandrun',
Expand Down
Loading