Merge branch 'feat/migration-to-leveldb' into feature/check-directory-permission

# Conflicts:
#	src/main/events/library/open-game.ts
#	src/main/events/user-preferences/update-user-preferences.ts
#	src/main/index.ts
#	src/main/main.ts
#	src/main/services/achievements/achievement-watcher-manager.ts
#	src/main/services/achievements/get-game-achievement-data.ts
#	src/main/services/notifications/index.ts
#	src/renderer/src/pages/downloads/download-group.tsx
This commit is contained in:
Zamitto 2025-01-29 09:38:32 -03:00
commit 04f5f26712
132 changed files with 1941 additions and 2604 deletions

View file

@ -1,24 +1,32 @@
import { gameRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import { shell } from "electron";
import { spawn } from "child_process";
import { parseExecutablePath } from "../helpers/parse-executable-path";
import { gamesSublevel, levelKeys } from "@main/level";
import { GameShop } from "@types";
import { parseLaunchOptions } from "../helpers/parse-launch-options";
const openGame = async (
_event: Electron.IpcMainInvokeEvent,
gameId: number,
shop: GameShop,
objectId: string,
executablePath: string,
launchOptions: string | null
launchOptions?: string | null
) => {
const parsedPath = parseExecutablePath(executablePath);
const parsedParams = parseLaunchOptions(launchOptions);
await gameRepository.update(
{ id: gameId },
{ executablePath: parsedPath, launchOptions }
);
const gameKey = levelKeys.game(shop, objectId);
const game = await gamesSublevel.get(gameKey);
if (!game) return;
await gamesSublevel.put(gameKey, {
...game,
executablePath: parsedPath,
launchOptions,
});
if (parsedParams.length === 0) {
shell.openPath(parsedPath);