diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index ee1d81fb..69bec6d3 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -103,9 +103,9 @@ "select_executable": "Select executable", "no_executable_selected": "No executable selected", "open_folder": "Open folder", + "open_download_location": "Abrir local de download", "create_shortcut": "Create shortcut", - "installer_path": "Installer path", - "remove_installer": "Remove installer" + "remove_files": "Remove files" }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 80aa040e..38250c3a 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -100,9 +100,9 @@ "select_executable": "Selecionar executável", "no_executable_selected": "Nenhum executável selecionado", "open_folder": "Abrir pasta", + "open_download_location": "Abrir local de download", "create_shortcut": "Criar atalho", - "installer_path": "Caminho do instalador", - "remove_installer": "Remover instalador" + "remove_files": "Remover arquivos" }, "activation": { "title": "Ativação", diff --git a/src/main/events/library/open-game-executable-path.ts b/src/main/events/library/open-game-executable-path.ts index 47aa0b47..09a0837c 100644 --- a/src/main/events/library/open-game-executable-path.ts +++ b/src/main/events/library/open-game-executable-path.ts @@ -1,5 +1,4 @@ import { shell } from "electron"; -import path from "node:path"; import { gameRepository } from "@main/repository"; import { registerEvent } from "../register-event"; @@ -11,12 +10,9 @@ const openGameExecutablePath = async ( where: { id: gameId, isDeleted: false }, }); - if (!game || !game.executablePath) return true; + if (!game || !game.executablePath) return; - const gamePath = path.join(game.executablePath, "../"); - - shell.openPath(gamePath); - return true; + shell.showItemInFolder(game.executablePath); }; registerEvent("openGameExecutablePath", openGameExecutablePath); diff --git a/src/main/events/library/open-game-installer-path.ts b/src/main/events/library/open-game-installer-path.ts index bb5d0c6f..dd7383ad 100644 --- a/src/main/events/library/open-game-installer-path.ts +++ b/src/main/events/library/open-game-installer-path.ts @@ -12,14 +12,14 @@ const openGameInstallerPath = async ( where: { id: gameId, isDeleted: false }, }); - if (!game || !game.folderName) return true; + if (!game || !game.folderName || !game.downloadPath) return true; const gamePath = path.join( game.downloadPath ?? (await getDownloadsPath()), game.folderName! ); - shell.openPath(gamePath); + shell.showItemInFolder(gamePath); return true; }; diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index 532fa8d7..c5fbc545 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -63,7 +63,7 @@ declare global { getLibrary: () => Promise; openGameInstaller: (gameId: number) => Promise; openGameInstallerPath: (gameId: number) => Promise; - openGameExecutablePath: (gameId: number) => Promise; + openGameExecutablePath: (gameId: number) => Promise; openGame: (gameId: number, executablePath: string) => Promise; closeGame: (gameId: number) => Promise; removeGameFromLibrary: (gameId: number) => Promise; diff --git a/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx b/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx index 8fbde41d..02d8f456 100644 --- a/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx +++ b/src/renderer/src/pages/game-details/hero/hero-panel-actions.tsx @@ -140,7 +140,7 @@ export function HeroPanelActions() { setShowGameOptionsModal(true); }} theme="outline" - disabled={deleting} + disabled={deleting || isGameRunning} className={styles.heroPanelAction} > diff --git a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx index 711fd6ba..4d8ae28f 100644 --- a/src/renderer/src/pages/game-details/modals/game-options-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/game-options-modal.tsx @@ -21,6 +21,8 @@ export function GameOptionsModal({ onClose, selectGameExecutable, }: GameOptionsModalProps) { + const { t } = useTranslation("game_details"); + const { updateGame, openRepacksModal } = useContext(gameDetailsContext); const [showDeleteModal, setShowDeleteModal] = useState(false); @@ -30,7 +32,10 @@ export function GameOptionsModal({ const deleting = game ? isGameDeleting(game?.id) : false; - const { t } = useTranslation("game_details"); + const { lastPacket } = useDownload(); + + const isGameDownloading = + game?.status === "active" && lastPacket?.game.id === game?.id; const handleRemoveGameFromLibrary = async () => { await removeGameFromLibrary(game.id); @@ -51,6 +56,10 @@ export function GameOptionsModal({ await window.electron.createGameShortcut(game.id); }; + const handleOpenDownloadFolder = async () => { + await window.electron.openGameInstallerPath(game.id); + }; + const handleDeleteGame = async () => { await removeGameInstaller(game.id); updateGame(); @@ -84,12 +93,12 @@ export function GameOptionsModal({ {t("open_download_options")}