From 11b4799ec9d71661e7f4dcfd121c1daec7a20f09 Mon Sep 17 00:00:00 2001 From: Duncan Bristow Date: Sat, 31 Oct 2015 15:17:16 -0600 Subject: [PATCH 1/2] Added some command line parameters --- NodeInstaller/index.js | 63 +++++++++++++++++++++++++++--------------- lib/BetterDiscord.js | 1 - sync.sh | 6 ++++ 3 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 sync.sh diff --git a/NodeInstaller/index.js b/NodeInstaller/index.js index aca2aa8..80b10fc 100644 --- a/NodeInstaller/index.js +++ b/NodeInstaller/index.js @@ -16,13 +16,28 @@ var _appArchive = "/app.asar"; var _packageJson = _appFolder + "/package.json"; var _index = _appFolder + "/app/index.js"; +var _force = false; + +// Get Arguments +process.argv.forEach(function (val, index, array) { + if (val == "--force") { + _force = true; + } + + if (val == "-d" || val == "--directory") { + _discordPath = array[(index+1)] + } +}); + function install() { - var _os = process.platform; - if (_os == "win32") { - _discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources"; - } else if (_os == "darwin") { - _discordPath = "/Applications/Discord.app/Contents/Resources/" // currently hardcoded to look in the Applications directory, will fix + if (typeof _discordPath == 'undefined') { + var _os = process.platform; + if (_os == "win32") { + _discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources"; + } else if (_os == "darwin") { + _discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory + } } console.log("Looking for discord resources at: " + _discordPath); @@ -112,25 +127,29 @@ function init() { var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); - rl.question("The following directories will be deleted if they exists: discorpath/app, discordpath/node_modules/BetterDiscord, is this ok? Y/N", function(answer) { + if (_force == false) { + rl.question("The following directories will be deleted if they exists: discorpath/app, discordpath/node_modules/BetterDiscord, is this ok? Y/N", function(answer) { - var alc = answer.toLowerCase(); + var alc = answer.toLowerCase(); - switch(alc) { - case "y": - install(); - break; - case "yes": - install(); - break; - case "n": - process.exit(); - break; - case "no": - process.exit(); - break; - } - }); + switch(alc) { + case "y": + install(); + break; + case "yes": + install(); + break; + case "n": + process.exit(); + break; + case "no": + process.exit(); + break; + } + }); + } else { + install(); + } } init(); diff --git a/lib/BetterDiscord.js b/lib/BetterDiscord.js index 0b781e0..cc8c340 100644 --- a/lib/BetterDiscord.js +++ b/lib/BetterDiscord.js @@ -19,7 +19,6 @@ var _mainWindow; var _updater; var _hash; - var _userDefault = {"cache": null}; var _userConfig = {"cache": null}; var _cacheExpired = false; diff --git a/sync.sh b/sync.sh new file mode 100644 index 0000000..fb8e9ad --- /dev/null +++ b/sync.sh @@ -0,0 +1,6 @@ +#!/bin/bash +git fetch upstream +git checkout master +git merge upstream/master +git push + From 5f4b380db4ff1d2dc30bdf1ab1fda79a79697462 Mon Sep 17 00:00:00 2001 From: Duncan Bristow Date: Sat, 31 Oct 2015 15:17:42 -0600 Subject: [PATCH 2/2] Whoops, added a test file. --- sync.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 sync.sh diff --git a/sync.sh b/sync.sh deleted file mode 100644 index fb8e9ad..0000000 --- a/sync.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -git fetch upstream -git checkout master -git merge upstream/master -git push -