mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-27 12:51:03 +00:00
20 lines
534 B
TypeScript
20 lines
534 B
TypeScript
import { gameRepository } from "@main/repository";
|
|
|
|
import { registerEvent } from "../register-event";
|
|
import { shell } from "electron";
|
|
import { parseExecutablePath } from "../helpers/parse-executable-path";
|
|
|
|
const openGame = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
gameId: number,
|
|
executablePath: string
|
|
) => {
|
|
const parsedPath = parseExecutablePath(executablePath);
|
|
|
|
await gameRepository.update({ id: gameId }, { executablePath: parsedPath });
|
|
|
|
shell.openPath(parsedPath);
|
|
};
|
|
|
|
registerEvent("openGame", openGame);
|