feat: improving cloud sync manual mapping

This commit is contained in:
Chubby Granny Chaser
2024-10-22 13:34:34 +01:00
parent 7de6e96f63
commit bfcf8178d8
15 changed files with 164 additions and 132 deletions

View File

@@ -122,12 +122,9 @@ const downloadGameArtifact = async (
cwd: backupPath,
})
.then(async () => {
const [game] = await Ludusavi.findGames(shop, objectId);
if (!game) throw new Error("Game not found in Ludusavi manifest");
replaceLudusaviBackupWithCurrentUser(
backupPath,
game.replaceAll(":", "_"),
objectId,
normalizePath(homeDir)
);

View File

@@ -1,17 +1,13 @@
import { registerEvent } from "../register-event";
import type { GameShop } from "@types";
import { Ludusavi } from "@main/services";
import path from "node:path";
import { backupsPath } from "@main/constants";
const getGameBackupPreview = async (
_event: Electron.IpcMainInvokeEvent,
objectId: string,
shop: GameShop
) => {
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
return Ludusavi.getBackupPreview(shop, objectId, backupPath);
return Ludusavi.getBackupPreview(shop, objectId);
};
registerEvent("getGameBackupPreview", getGameBackupPreview);

View File

@@ -0,0 +1,14 @@
import { registerEvent } from "../register-event";
import type { GameShop } from "@types";
import { Ludusavi } from "@main/services";
const selectGameBackupPath = async (
_event: Electron.IpcMainInvokeEvent,
_shop: GameShop,
objectId: string,
backupPath: string | null
) => {
return Ludusavi.addCustomGame(objectId, backupPath);
};
registerEvent("selectGameBackupPath", selectGameBackupPath);