Skip to content

[Fix] Sideload: Don't update game settings if we're in editMode #3848

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
merged 1 commit into from
Jul 21, 2024
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
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
Loading