This commit is contained in:
HarJIT 2018-04-28 18:39:20 +00:00 committed by GitHub
commit f43c09ce76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 11 deletions

View File

@ -41,14 +41,18 @@ function install() {
_importSplice = 89;
_functionCallSplice = 497;
_functionSplice = 601;
_discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources";
_discordPath = process.env.LOCALAPPDATA + "/Discord/app-"+dver+"/resources";
} else if (_os == "darwin") {
_importSplice = 67;
_functionCallSplice = 446;
_functionSplice = 547;
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
} else if (_os == "linux") {
_discordPath = "/opt/DiscordCanary/resources";
if (fs.existsSync("/opt/DiscordCanary/resources")) {
_discordPath = "/opt/DiscordCanary/resources";
} else {
_discordPath = "/usr/share/discord/resources";
}
_index = "/app/index.js";
}
}
@ -238,7 +242,7 @@ function init() {
var rl = readline.createInterface({ input: process.stdin, output: process.stdout });
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) {
rl.question("The following directories will be deleted if they exists: discordpath/app, discordpath/node_modules/BetterDiscord, is this ok [Y/N]? ", function(answer) {
var alc = answer.toLowerCase();

View File

@ -1,5 +1,5 @@
#!/bin/bash
# As there is no Linux support, this script assumes OS X as the host system.
# For macOS X and Linux (if using Linux, run this script with sudo).
command -v node > /dev/null || (echo 'Node not found, please download it!' && open 'https://nodejs.org/en/' && sleep 5 && exit)

View File

@ -10,7 +10,12 @@
var _fs = require("fs");
var _config = require("./config.json");
var _utils = require("./utils");
var _utils;
try {
_utils = require("./utils");
} catch (e) {
_utils = require("./Utils");
}
var _utils2;
var _bdIpc = require('electron').ipcMain;
var _error = false;
@ -34,9 +39,9 @@ bdPluginStorage.defaults = {
};
function initStorage() {
if(!_fs.existsSync(_cfg.dataPath + "/bdstorage.json")) {
if(!_fs.existsSync(_cfg.dataPath + "/bdStorage.json")) {
bdStorage.data = bdStorage.defaults.data;
_fs.writeFileSync(_cfg.dataPath + "/bdstorage.json", JSON.stringify(bdStorage, null, 4));
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage, null, 4));
} else {
bdStorage.data = JSON.parse(_fs.readFileSync(_cfg.dataPath + "/bdStorage.json"));
}
@ -44,7 +49,7 @@ function initStorage() {
bdStorage.get = function(i, m, pn) {
if (typeof bdStorage.data == "undefined") { initStorage(); }
if(m) return bdStorage.data[i] || "";
if(bdPluginStorage[pn] !== undefined) {
@ -62,7 +67,7 @@ bdStorage.get = function(i, m, pn) {
bdStorage.set = function(i, v, m, pn) {
if(m) {
bdStorage.data[i] = v;
_fs.writeFileSync(_cfg.dataPath + "/bdstorage.json", JSON.stringify(bdStorage.data, null, 4));
_fs.writeFileSync(_cfg.dataPath + "/bdStorage.json", JSON.stringify(bdStorage.data, null, 4));
} else {
if(bdPluginStorage[pn] === undefined) bdPluginStorage[pn] = {};
bdPluginStorage[pn][i] = v;
@ -87,7 +92,7 @@ function BetterDiscord(mainWindow) {
function createAndCheckData() {
getUtils().log("Checking data/cache");
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : '/var/local') + '/BetterDiscord/';
_cfg.dataPath = (_cfg.os == 'win32' ? process.env.APPDATA : _cfg.os == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + '/.config') + '/BetterDiscord/';
_cfg.userFile = _cfg.dataPath + 'user.json';
try {
@ -842,4 +847,4 @@ function exit(reason) {
BetterDiscord.prototype.init = function() {}//Compatibility
exports.BetterDiscord = BetterDiscord;
exports.BetterDiscord = BetterDiscord;