Skip to content

Commit

Permalink
Merge pull request #1254 from JarEXE/feature/clearpaths
Browse files Browse the repository at this point in the history
feat: allow clearing game executable path and wine prefix
  • Loading branch information
zamitto authored Dec 9, 2024
2 parents 0157d54 + fb1cc9b commit 590a15e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"open_folder": "Open folder",
"open_download_location": "See downloaded files",
"create_shortcut": "Create desktop shortcut",
"clear": "Clear",
"remove_files": "Remove files",
"remove_from_library_title": "Are you sure?",
"remove_from_library_description": "This will remove {{game}} from your library",
Expand Down
20 changes: 20 additions & 0 deletions src/renderer/src/pages/game-details/modals/game-options-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export function GameOptionsModal({
await window.electron.openGameExecutablePath(game.id);
};

const handleClearExecutablePath = async () => {
await window.electron.updateExecutablePath(game.id, "");
updateGame();
};

const handleChangeWinePrefixPath = async () => {
const { filePaths } = await window.electron.showOpenDialog({
properties: ["openDirectory"],
Expand All @@ -106,6 +111,11 @@ export function GameOptionsModal({
}
};

const handleClearWinePrefixPath = async () => {
await window.electron.selectGameWinePrefix(game.id, "");
updateGame();
};

const shouldShowWinePrefixConfiguration =
window.electron.platform === "linux";

Expand Down Expand Up @@ -168,6 +178,9 @@ export function GameOptionsModal({
<Button onClick={handleCreateShortcut} theme="outline">
{t("create_shortcut")}
</Button>
<Button onClick={handleClearExecutablePath} theme="outline">
{t("clear")}
</Button>
</div>
)}

Expand Down Expand Up @@ -196,6 +209,13 @@ export function GameOptionsModal({
</Button>
}
/>
{game.winePrefixPath && (
<div className={styles.gameOptionRow}>
<Button onClick={handleClearWinePrefixPath} theme="outline">
{t("clear")}
</Button>
</div>
)}
</div>
)}

Expand Down

0 comments on commit 590a15e

Please sign in to comment.