fix: adding wine prefix to preview

This commit is contained in:
Chubby Granny Chaser 2024-10-22 13:39:41 +01:00
parent bfcf8178d8
commit ceef316a19
No known key found for this signature in database
2 changed files with 12 additions and 3 deletions

View file

@ -1,13 +1,21 @@
import { registerEvent } from "../register-event"; import { registerEvent } from "../register-event";
import type { GameShop } from "@types"; import type { GameShop } from "@types";
import { Ludusavi } from "@main/services"; import { Ludusavi } from "@main/services";
import { gameRepository } from "@main/repository";
const getGameBackupPreview = async ( const getGameBackupPreview = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
objectId: string, objectId: string,
shop: GameShop shop: GameShop
) => { ) => {
return Ludusavi.getBackupPreview(shop, objectId); const game = await gameRepository.findOne({
where: {
objectID: objectId,
shop,
},
});
return Ludusavi.getBackupPreview(shop, objectId, game?.winePrefixPath);
}; };
registerEvent("getGameBackupPreview", getGameBackupPreview); registerEvent("getGameBackupPreview", getGameBackupPreview);

View file

@ -52,12 +52,13 @@ export class Ludusavi {
static async getBackupPreview( static async getBackupPreview(
_shop: GameShop, _shop: GameShop,
objectId: string objectId: string,
winePrefix?: string | null
): Promise<LudusaviBackup | null> { ): Promise<LudusaviBackup | null> {
const config = await this.getConfig(); const config = await this.getConfig();
const backupData = await this.worker.run( const backupData = await this.worker.run(
{ title: objectId, preview: true }, { title: objectId, winePrefix, preview: true },
{ name: "backupGame" } { name: "backupGame" }
); );