fix: removing backup folder before uploading

This commit is contained in:
Chubby Granny Chaser 2024-10-07 22:29:48 +01:00
parent 75be6e5b47
commit 9405b0dcfc
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View file

@ -42,6 +42,7 @@ const replaceLudusaviBackupWithCurrentUser = (
// Directories are different, rename
if (backupHomeDir !== currentHomeDir) {
if (fs.existsSync(newPath)) {
// Ensures that the destination is empty
fs.rmSync(newPath, {
recursive: true,
force: true,

View file

@ -13,6 +13,11 @@ import { app } from "electron";
const bundleBackup = async (shop: GameShop, objectId: string) => {
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
// Remove existing backup
if (fs.existsSync(backupPath)) {
fs.rmSync(backupPath, { recursive: true });
}
await Ludusavi.backupGame(shop, objectId, backupPath);
const tarLocation = path.join(backupsPath, `${crypto.randomUUID()}.zip`);