From 36e4eae4233259f1d3b6170aa2b74725165674bf Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 12 Jan 2025 16:40:57 +0100 Subject: [PATCH] build: update SVR.JS installation script to work with zip archives without svr.compressed --- svrjs.install.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/svrjs.install.js b/svrjs.install.js index 4071d34..97b951f 100644 --- a/svrjs.install.js +++ b/svrjs.install.js @@ -57,15 +57,17 @@ function downloadSVRJS(version) { ); }); if (!fs.existsSync(__dirname + "/svrjs/mods")) fs.mkdirSync(__dirname + "/svrjs/mods"); - console.log("Deleting SVR.JS stub..."); - fs.unlinkSync(__dirname + "/svrjs/svr.js"); - // Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here. - console.log("Decompressing SVR.JS..."); - const script = zlib.gunzipSync( - fs.readFileSync(__dirname + "/svrjs/svr.compressed") - ); - fs.unlinkSync(__dirname + "/svrjs/svr.compressed"); - fs.writeFileSync(__dirname + "/svrjs/svr.js", script); + if (fs.existsSync(__dirname + "/svrjs/svr.compressed")) { + console.log("Deleting SVR.JS stub..."); + fs.unlinkSync(__dirname + "/svrjs/svr.js"); + // Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here. + console.log("Decompressing SVR.JS..."); + const script = zlib.gunzipSync( + fs.readFileSync(__dirname + "/svrjs/svr.compressed") + ); + fs.unlinkSync(__dirname + "/svrjs/svr.compressed"); + fs.writeFileSync(__dirname + "/svrjs/svr.js", script); + } console.log("SVR.JS is installed successfully."); }); }