Added some command line parameters

This commit is contained in:
Duncan Bristow 2015-10-31 15:17:16 -06:00
parent 306a00152a
commit 11b4799ec9
3 changed files with 47 additions and 23 deletions

View File

@ -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();

View File

@ -19,7 +19,6 @@ var _mainWindow;
var _updater;
var _hash;
var _userDefault = {"cache": null};
var _userConfig = {"cache": null};
var _cacheExpired = false;

6
sync.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
git fetch upstream
git checkout master
git merge upstream/master
git push