feat: make it possible to select shortcuts (.lnk)

This commit is contained in:
Zamitto 2024-06-27 18:05:07 -03:00
parent 82f72071f9
commit 7be626b3dd
5 changed files with 27 additions and 5 deletions

View file

@ -2,15 +2,18 @@ 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
) => {
await gameRepository.update({ id: gameId }, { executablePath });
const parsedPath = parseExecutablePath(executablePath);
shell.openPath(executablePath);
await gameRepository.update({ id: gameId }, { executablePath: parsedPath });
shell.openPath(parsedPath);
};
registerEvent("openGame", openGame);