fix: fixing window on macos

This commit is contained in:
Chubby Granny Chaser 2024-11-02 14:44:42 +00:00
parent 238d207590
commit 3e33e1f4b3
No known key found for this signature in database
10 changed files with 57 additions and 2823 deletions

View file

@ -63,7 +63,7 @@ export class WindowManager {
minWidth: 1024,
minHeight: 540,
backgroundColor: "#1c1c1c",
titleBarStyle: process.platform === "win32" ? "hidden" : "default",
titleBarStyle: process.platform === "linux" ? "default" : "hidden",
...(process.platform === "linux" ? { icon } : {}),
trafficLightPosition: { x: 16, y: 16 },
titleBarOverlay: {

View file

@ -5,6 +5,8 @@ import { workerData } from "node:worker_threads";
const { binaryPath } = workerData;
let backupGameProcess: cp.ChildProcess | null = null;
export const backupGame = ({
title,
backupPath,
@ -16,15 +18,32 @@ export const backupGame = ({
preview?: boolean;
winePrefix?: string;
}) => {
const args = ["backup", title, "--api", "--force"];
if (backupGameProcess && !backupGameProcess.killed) {
backupGameProcess.kill();
backupGameProcess = null;
}
if (preview) args.push("--preview");
if (backupPath) args.push("--path", backupPath);
if (winePrefix) args.push("--wine-prefix", winePrefix);
return new Promise((resolve, reject) => {
const args = ["backup", title, "--api", "--force"];
const result = cp.execFileSync(binaryPath, args);
if (preview) args.push("--preview");
if (backupPath) args.push("--path", backupPath);
if (winePrefix) args.push("--wine-prefix", winePrefix);
return JSON.parse(result.toString("utf-8")) as LudusaviBackup;
backupGameProcess = cp.execFile(
binaryPath,
args,
(err: cp.ExecFileException | null, stdout: string) => {
if (err) {
backupGameProcess = null;
return reject(err);
}
backupGameProcess = null;
return resolve(JSON.parse(stdout) as LudusaviBackup);
}
);
});
};
export const restoreBackup = (backupPath: string) => {