Update Linux support to 0.0.14
Signed-off-by: Nick Sarnie <commendsarnex@gmail.com>
This commit is contained in:
parent
f08539d5f9
commit
be22c14356
|
@ -47,6 +47,9 @@ function install() {
|
|||
_functionCallSplice = 446;
|
||||
_functionSplice = 547;
|
||||
_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);
|
||||
|
@ -80,8 +83,12 @@ function install() {
|
|||
asar.extractAll(_discordPath + _appArchive, _discordPath + _appFolder);
|
||||
|
||||
console.log("Copying BetterDiscord");
|
||||
|
||||
fs.mkdirSync(_discordPath + "/node_modules/BetterDiscord");
|
||||
if(_os == "linux") {
|
||||
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});
|
||||
|
||||
|
@ -99,8 +106,18 @@ function install() {
|
|||
console.log("Injecting index.js");
|
||||
|
||||
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) {
|
||||
if(err) return console.log(err);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
var _fs = require("fs");
|
||||
var _config = require("./config.json");
|
||||
var _utils = require("./utils");
|
||||
var _utils;
|
||||
var _utils2;
|
||||
var _bdIpc = require('electron').ipcMain;
|
||||
var _error = false;
|
||||
|
@ -79,6 +79,7 @@ function BetterDiscord(mainWindow) {
|
|||
_cfg = _config.cfg;
|
||||
_cfg.version = _config.Core.Version;
|
||||
_cfg.os = process.platform;
|
||||
_utils = _cfg.os == "linux" ? require("./Utils") : require("./utils");
|
||||
_utils2 = new _utils.Utils(mainWindow);
|
||||
hook();
|
||||
createAndCheckData();
|
||||
|
@ -87,7 +88,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 {
|
||||
|
@ -833,4 +834,4 @@ function exit(reason) {
|
|||
|
||||
BetterDiscord.prototype.init = function() {}//Compatibility
|
||||
|
||||
exports.BetterDiscord = BetterDiscord;
|
||||
exports.BetterDiscord = BetterDiscord;
|
||||
|
|
Loading…
Reference in New Issue