Skip to content

Commit

Permalink
FIX BROKEN INCLUDE AFTER COMPILE ?
Browse files Browse the repository at this point in the history
  • Loading branch information
whitewhidow committed Dec 28, 2020
1 parent e725042 commit 4649e0a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ global.currentConfiguration = {}



eval(require('fs').readFileSync('versioncheck.js')+'');
eval(require('fs').readFileSync(__dirname+'/versioncheck.js')+'');


var tools = require("./tools")
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sidenoder",
"version": "0.0.10",
"version": "0.0.11",
"description": "SideNoder",
"main": "main.js",
"dependencies": {
Expand Down
31 changes: 17 additions & 14 deletions tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)


Expand All @@ -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"
Expand All @@ -279,7 +284,7 @@ async function mount(){
console.log(`stdout: ${stdout}`);
});

console.log("na")
//console.log("na")
}


Expand Down Expand Up @@ -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);
}


Expand Down

0 comments on commit 4649e0a

Please sign in to comment.