Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Get it to install on my Ubuntu box. #543

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Installers/Node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion Installers/Node/install.sh
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
19 changes: 12 additions & 7 deletions lib/BetterDiscord.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,17 +39,17 @@ 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"));
}
};


bdStorage.get = function(i, m, pn) {

if (typeof bdStorage.data == "undefined") { initStorage(); }
if(m) return bdStorage.data[i] || "";

if(bdPluginStorage[pn] !== undefined) {
Expand All @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -842,4 +847,4 @@ function exit(reason) {

BetterDiscord.prototype.init = function() {}//Compatibility

exports.BetterDiscord = BetterDiscord;
exports.BetterDiscord = BetterDiscord;