Merge pull request #288 from sarnex/master
Update Linux support to 0.0.13
This commit is contained in:
commit
11190a8a4c
|
@ -47,6 +47,9 @@ function install() {
|
||||||
_functionCallSplice = 446;
|
_functionCallSplice = 446;
|
||||||
_functionSplice = 547;
|
_functionSplice = 547;
|
||||||
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
|
_discordPath = "/Applications/Discord.app/Contents/Resources" // Defaults to Applications directory
|
||||||
|
} else if (_os == "linux") {
|
||||||
|
_discordPath = "/opt/DiscordCanary/resources";
|
||||||
|
_index = "/app/index.js";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Looking for discord resources at: " + _discordPath);
|
console.log("Looking for discord resources at: " + _discordPath);
|
||||||
|
@ -80,8 +83,12 @@ function install() {
|
||||||
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
|
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
|
||||||
|
|
||||||
console.log("Copying BetterDiscord");
|
console.log("Copying BetterDiscord");
|
||||||
|
if(_os == "linux") {
|
||||||
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
|
fs.mkdirSync(_discordPath + _appFolder + "/node_modules/BetterDiscord");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
|
||||||
|
}
|
||||||
|
|
||||||
wrench.copyDirSyncRecursive(__dirname + "/BetterDiscord/", _discordPath + _appFolder + "/node_modules/BetterDiscord/", {forceDelete: true});
|
wrench.copyDirSyncRecursive(__dirname + "/BetterDiscord/", _discordPath + _appFolder + "/node_modules/BetterDiscord/", {forceDelete: true});
|
||||||
|
|
||||||
|
@ -99,8 +106,18 @@ function install() {
|
||||||
console.log("Injecting index.js");
|
console.log("Injecting index.js");
|
||||||
|
|
||||||
var data = fs.readFileSync(_discordPath + _index).toString().split("\n");
|
var data = fs.readFileSync(_discordPath + _index).toString().split("\n");
|
||||||
data.splice(_importSplice, 0, 'var _betterDiscord = require(\'betterdiscord\');\n');
|
|
||||||
data.splice(_functionCallSplice, 0, splice);
|
if(_os == "linux") {
|
||||||
|
data = data.join("\n");
|
||||||
|
data = data.replace('var _GPUSettings2 = _interopRequireDefault(_GPUSettings);','var _GPUSettings2 = _interopRequireDefault(_GPUSettings);\n\nvar _betterDiscord = require(\'BetterDiscord\');\n');
|
||||||
|
|
||||||
|
data = data.replace('mainWindow.setMenuBarVisibility(false);','mainWindow.setMenuBarVisibility(false);\n' + splice + '\n');
|
||||||
|
data = data.split("\n");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data.splice(_importSplice, 0, 'var _betterDiscord = require(\'betterdiscord\');\n');
|
||||||
|
data.splice(_functionCallSplice, 0, splice);
|
||||||
|
}
|
||||||
|
|
||||||
fs.writeFile(_discordPath + _index, data.join("\n"), function(err) {
|
fs.writeFile(_discordPath + _index, data.join("\n"), function(err) {
|
||||||
if(err) return console.log(err);
|
if(err) return console.log(err);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
let __fs = window.require("fs");
|
let __fs = window.require("fs");
|
||||||
let __process = window.require("process");
|
let __process = window.require("process");
|
||||||
let __platform = __process.platform;
|
let __platform = __process.platform;
|
||||||
let __dataPath = (__platform === 'win32' ? __process.env.APPDATA : __platform === 'darwin' ? __process.env.HOME + '/Library/Preferences' : '/var/local') + '/BetterDiscord/';
|
let __dataPath = (__platform === 'win32' ? __process.env.APPDATA : __platform === 'darwin' ? __process.env.HOME + '/Library/Preferences' : process.env.HOME + '/.config') + '/BetterDiscord/';
|
||||||
|
|
||||||
|
|
||||||
let __data = {};
|
let __data = {};
|
||||||
|
@ -2611,4 +2611,4 @@ BdApi.setStatus = function (idle_since, status) {
|
||||||
devMode.prototype.disable = function() {
|
devMode.prototype.disable = function() {
|
||||||
$(window).off("keydown.bdDevmode");
|
$(window).off("keydown.bdDevmode");
|
||||||
$(window).off("mousedown.bdDevmode")
|
$(window).off("mousedown.bdDevmode")
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
var _fs = require("fs");
|
var _fs = require("fs");
|
||||||
var _config = require("./config.json");
|
var _config = require("./config.json");
|
||||||
var _utils = require("./utils");
|
var _utils;
|
||||||
var _utils2;
|
var _utils2;
|
||||||
var _bdIpc = require('electron').ipcMain;
|
var _bdIpc = require('electron').ipcMain;
|
||||||
var _error = false;
|
var _error = false;
|
||||||
|
@ -79,6 +79,7 @@ function BetterDiscord(mainWindow) {
|
||||||
_cfg = _config.cfg;
|
_cfg = _config.cfg;
|
||||||
_cfg.version = _config.Core.Version;
|
_cfg.version = _config.Core.Version;
|
||||||
_cfg.os = process.platform;
|
_cfg.os = process.platform;
|
||||||
|
_utils = _cfg.os == "linux" ? require("./Utils") : require("./utils");
|
||||||
_utils2 = new _utils.Utils(mainWindow);
|
_utils2 = new _utils.Utils(mainWindow);
|
||||||
hook();
|
hook();
|
||||||
createAndCheckData();
|
createAndCheckData();
|
||||||
|
@ -87,7 +88,7 @@ function BetterDiscord(mainWindow) {
|
||||||
function createAndCheckData() {
|
function createAndCheckData() {
|
||||||
getUtils().log("Checking data/cache");
|
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';
|
_cfg.userFile = _cfg.dataPath + 'user.json';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -833,4 +834,4 @@ function exit(reason) {
|
||||||
|
|
||||||
BetterDiscord.prototype.init = function() {}//Compatibility
|
BetterDiscord.prototype.init = function() {}//Compatibility
|
||||||
|
|
||||||
exports.BetterDiscord = BetterDiscord;
|
exports.BetterDiscord = BetterDiscord;
|
||||||
|
|
Loading…
Reference in New Issue