mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
fixed function arguments
This commit is contained in:
parent
d4aebf7d99
commit
ea412c64c3
@ -131,9 +131,11 @@ export function GameDetailsContextProvider({
|
||||
return window.electron.getDefaultDownloadsPath();
|
||||
};
|
||||
|
||||
const selectGameExecutable = async (gameInstallerFolderIfExists: string | null) => {
|
||||
|
||||
const downloadsPath = gameInstallerFolderIfExists ?? await getDownloadsPath();
|
||||
const selectGameExecutable = async (
|
||||
gameInstallerFolderIfExists?: string
|
||||
) => {
|
||||
const downloadsPath =
|
||||
gameInstallerFolderIfExists ?? (await getDownloadsPath());
|
||||
|
||||
return window.electron
|
||||
.showOpenDialog({
|
||||
|
@ -13,7 +13,9 @@ export interface GameDetailsContext {
|
||||
showRepacksModal: boolean;
|
||||
showGameOptionsModal: boolean;
|
||||
setGameColor: React.Dispatch<React.SetStateAction<string>>;
|
||||
selectGameExecutable: (gameInstallerFolderIfExists: string | null) => Promise<string | null>;
|
||||
selectGameExecutable: (
|
||||
gameInstallerFolderIfExists?: string
|
||||
) => Promise<string | null>;
|
||||
updateGame: () => Promise<void>;
|
||||
setShowRepacksModal: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
setShowGameOptionsModal: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
|
@ -53,21 +53,25 @@ export function HeroPanelActions() {
|
||||
return;
|
||||
}
|
||||
|
||||
let gameInstallerFolderIfExists: string | null = null
|
||||
let gameInstallerFolderIfExists
|
||||
|
||||
if (game && game.folderName){
|
||||
if (game && game.folderName) {
|
||||
let downloadsPath = await window.electron.getDefaultDownloadsPath();
|
||||
if (userPreferences?.downloadsPath)
|
||||
downloadsPath = userPreferences.downloadsPath;
|
||||
|
||||
const folderSeparator = window.electron.platform == 'win32'
|
||||
? '\\'
|
||||
: '/'
|
||||
const folderSeparator =
|
||||
window.electron.platform == "win32" ? "\\" : "/";
|
||||
|
||||
gameInstallerFolderIfExists = (game.downloadPath ?? downloadsPath)+folderSeparator+game.folderName!
|
||||
gameInstallerFolderIfExists =
|
||||
(game.downloadPath ?? downloadsPath) +
|
||||
folderSeparator +
|
||||
game.folderName!;
|
||||
}
|
||||
|
||||
const gameExecutablePath = await selectGameExecutable(gameInstallerFolderIfExists);
|
||||
const gameExecutablePath = await selectGameExecutable(
|
||||
gameInstallerFolderIfExists
|
||||
);
|
||||
if (gameExecutablePath)
|
||||
window.electron.openGame(game.id, gameExecutablePath);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user