From 4649e0a802ec2e1ff7a1f3732c70b0008588acc3 Mon Sep 17 00:00:00 2001 From: whitewhidow Date: Mon, 28 Dec 2020 23:40:19 +0100 Subject: [PATCH] FIX BROKEN INCLUDE AFTER COMPILE ? --- main.js | 2 +- package.json | 2 +- tools.js | 31 +++++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/main.js b/main.js index b2c80bf..4472b24 100644 --- a/main.js +++ b/main.js @@ -18,7 +18,7 @@ global.currentConfiguration = {} -eval(require('fs').readFileSync('versioncheck.js')+''); +eval(require('fs').readFileSync(__dirname+'/versioncheck.js')+''); var tools = require("./tools") diff --git a/package.json b/package.json index b0ca01b..e12c6b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sidenoder", - "version": "0.0.10", + "version": "0.0.11", "description": "SideNoder", "main": "main.js", "dependencies": { diff --git a/tools.js b/tools.js index 575e756..30f298c 100644 --- a/tools.js +++ b/tools.js @@ -19,8 +19,10 @@ const configLocation = require('path').join(homedir, "sidenoder-config.json") if (`${platform}` != "win64" && `${platform}` != "win32") { global.nullcmd = "> /dev/null" + global.nullerror = "2> /dev/null" } else { global.nullcmd = "> null" + global.nullerror = "2> null" } @@ -111,12 +113,15 @@ function execShellCommand(cmd, buffer = 5000) { return new Promise((resolve, reject) => { exec(cmd, {maxBuffer: 1024 * buffer}, (error, stdout, stderr) => { if (error) { - console.warn(error); + console.log('exec_error') + //console.warn(error); } if (stdout) { + console.log('exec_stdout') console.log(stdout) resolve(stdout); } else { + console.log('exec_stderr') console.log(stderr) resolve(stderr); } @@ -226,22 +231,22 @@ async function mount(){ if (`${global.platform}` != "win64" && `${global.platform}` != "win32") { - await execShellCommand(`umount ${mountFolder}`); - await execShellCommand(`fusermount -uz ${mountFolder}`); - console.log(mountFolder); + await execShellCommand(`umount ${mountFolder} ${global.nullerror}`); + await execShellCommand(`fusermount -uz ${mountFolder} ${global.nullerror}`); await fs.mkdir(mountFolder, {}, ()=>{}) // folder must exist on windows - console.log(mountFolder); } + if (`${global.platform}` == "win64" || `${global.platform}` == "win32") { - await execShellCommand(`rmdir "${mountFolder}"`); // folder must NOT exist on windows + await execShellCommand(`rmdir "${mountFolder}" ${global.nullerror}`); // folder must NOT exist on windows } + let content = await fetch("https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/extras/k") content = await content.text() let buff = Buffer.from(content, 'base64'); const key = buff.toString('ascii'); kpath = require('path').join(tmpdir, "k") - console.log(kpath) + //console.log(kpath) fs.writeFileSync(kpath, key) @@ -252,11 +257,11 @@ async function mount(){ config = config.replace("XXX", kpath); cpath = require('path').join(tmpdir, "c") - console.log(cpath) + //console.log(cpath) fs.writeFileSync(cpath, config) - console.log("voor") + //console.log("voor") if (`${platform}` === "darwin") { var mountCmd = "cmount" @@ -279,7 +284,7 @@ async function mount(){ console.log(`stdout: ${stdout}`); }); - console.log("na") + //console.log("na") } @@ -681,21 +686,19 @@ function updateRcloneProgress() { } function reloadConfig() { - console.log(configLocation) const defaultConfig = {autoMount: false}; try { if (fs.existsSync(configLocation)) { - console.log("Config exist, using"); + console.log("Config exist, using " + configLocation); global.currentConfiguration = require(configLocation); } else { - console.log("Config doesnt exist, creating"); + console.log("Config doesnt exist, creating ") + configLocation; fs.writeFileSync(configLocation, JSON.stringify(defaultConfig)) global.currentConfiguration = defaultConfig; } } catch(err) { console.error(err); } - console.log(global.currentConfiguration); }