From 5c62e5a5c5f61b43b7788528872996772e39e10e Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 12 Feb 2022 19:49:42 +0100 Subject: Update --- commands/install.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'commands/install.js') diff --git a/commands/install.js b/commands/install.js index 6f0df0c..b08ebe5 100644 --- a/commands/install.js +++ b/commands/install.js @@ -145,12 +145,17 @@ module.exports = async (argv) => { spinner.succeed("Extracting package... done"); console.log(" Size change: +" + require('../hooks/size')(pkg.id)); + let exec = argv.package; + if (typeof JSON.parse(fs.readFileSync(home + "/repository/" + dir + "/" + argv.package + ".json").toString()).execname === "string") { + exec = JSON.parse(fs.readFileSync(home + "/repository/" + dir + "/" + argv.package + ".json").toString()).execname; + } + if (os.platform() === "win32" && typeof pkg.executable.windows === "string") { - fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + pkg.id + ".bat", pkg.executable.windows); + fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + exec + ".bat", pkg.executable.windows); } else if (os.platform() === "linux" && typeof pkg.executable.linux === "string") { - fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + pkg.id + ".sh", pkg.executable.linux); + fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + exec + ".sh", pkg.executable.linux); } else if (os.platform() === "darwin" && typeof pkg.executable.mac === "string") { - fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + pkg.id + ".sh", pkg.executable.mac); + fs.writeFileSync(os.homedir() + "/.twilight/binaries/" + exec + ".sh", pkg.executable.mac); } let postinstall = []; -- cgit