Skip to content

Commit

Permalink
[Fix] Sideload: Don't update game settings if we're in editMode (#3848)
Browse files Browse the repository at this point in the history
Don't update game settings if we're in editMode

EditMode hides the Wine prefix/version / CrossOver bottle selector and also
doesn't set it, so clicking "Finish" resets them to their default values
  • Loading branch information
CommandMC authored Jul 21, 2024
1 parent 6eecf22 commit cfbdc4d
Showing 1 changed file with 17 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,14 @@ export default function SideloadDialog({
}
}, [])

// Suggest default Wine prefix if we're adding a new app
useEffect(() => {
const setWine = async () => {
if (editMode && appName) {
const appSettings = await window.api.getGameSettings(
appName,
'sideload'
)
if (appSettings?.winePrefix) {
setWinePrefix(appSettings.winePrefix)
}
return
} else {
const { defaultWinePrefix } = await window.api.requestAppSettings()
const sugestedWinePrefix = `${defaultWinePrefix}/${title}`
setWinePrefix(sugestedWinePrefix)
}
}
setWine()
}, [title])
if (editMode) return
window.api.requestAppSettings().then(({ defaultWinePrefix }) => {
const suggestedWinePrefix = `${defaultWinePrefix}/${title}`
setWinePrefix(suggestedWinePrefix)
})
}, [title, editMode])

async function searchImage() {
setSearching(true)
Expand Down Expand Up @@ -181,15 +170,16 @@ export default function SideloadDialog({
if (!gameSettings) {
return
}
await writeConfig({
appName: app_name,
config: {
...gameSettings,
winePrefix,
wineVersion,
wineCrossoverBottle: crossoverBottle
}
})
if (!editMode)
window.api.writeConfig({
appName: app_name,
config: {
...gameSettings,
winePrefix,
wineVersion,
wineCrossoverBottle: crossoverBottle
}
})

await refreshLibrary({
library: 'sideload',
Expand Down

0 comments on commit cfbdc4d

Please sign in to comment.