Refix for Linux
Most of this is fixing things that assume the OS is case insensitive.
This commit is contained in:
parent
d55d027d69
commit
312e7204bf
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue