diff --git a/index.ts b/index.ts deleted file mode 100644 index b7cc9340..00000000 --- a/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import vdf from "vdf-parser"; -import fs from "node:fs"; - -const vdfData = fs.readFileSync( - "/home/chubby/.local/share/Steam/userdata/1126196664/config/localconfig.vdf", - "utf-8" -); -const data = vdf.parse(vdfData); - -console.log(data); diff --git a/scripts/postinstall.cjs b/scripts/postinstall.cjs index 8deddeaa..b187b29f 100644 --- a/scripts/postinstall.cjs +++ b/scripts/postinstall.cjs @@ -15,8 +15,18 @@ const fileName = { darwin: `ludusavi-v${ludusaviVersion}-mac.tar.gz`, }; +const ludusaviBinaryName = { + win32: "ludusavi.exe", + linux: "ludusavi", + darwin: "ludusavi", +}; + const downloadLudusavi = async () => { - if (fs.existsSync("ludusavi")) { + if ( + fs.existsSync( + path.join(process.cwd(), "ludusavi", ludusaviBinaryName[process.platform]) + ) + ) { console.log("Ludusavi already exists, skipping download..."); return; } diff --git a/src/main/services/ludusavi.ts b/src/main/services/ludusavi.ts index cc1bd8b3..1a07a495 100644 --- a/src/main/services/ludusavi.ts +++ b/src/main/services/ludusavi.ts @@ -106,9 +106,6 @@ export class Ludusavi { config.customGames = filteredGames; - fs.writeFileSync( - path.join(this.ludusaviPath, "config.yaml"), - YAML.stringify(config) - ); + fs.writeFileSync(this.configPath, YAML.stringify(config)); } } diff --git a/src/main/services/wine.ts b/src/main/services/wine.ts index 8a860ab2..233e6dec 100644 --- a/src/main/services/wine.ts +++ b/src/main/services/wine.ts @@ -4,18 +4,18 @@ import path from "node:path"; export class Wine { public static validatePrefix(winePrefixPath: string) { const requiredFiles = [ - "system.reg", - "user.reg", - "userdef.reg", - "dosdevices", - "drive_c", + { name: "system.reg", type: "file" }, + { name: "user.reg", type: "file" }, + { name: "userdef.reg", type: "file" }, + { name: "dosdevices", type: "dir" }, + { name: "drive_c", type: "dir" }, ]; for (const file of requiredFiles) { - const filePath = path.join(winePrefixPath, file); - if (!fs.existsSync(filePath)) { - return false; - } + const filePath = path.join(winePrefixPath, file.name); + + if (file.type === "file") return !fs.existsSync(filePath); + if (file.type === "dir") return !fs.lstatSync(filePath).isDirectory(); } return true;