diff --git a/lib/BetterDiscord.js b/lib/BetterDiscord.js index 1cf442bd..0b781e0e 100644 --- a/lib/BetterDiscord.js +++ b/lib/BetterDiscord.js @@ -9,6 +9,9 @@ var _fs = require("fs"); var _config = require("./config.json"); var _utils = require("./utils"); +//Use beta javascript +var _beta = false; + var _ipc = require('ipc'); var _version; @@ -21,7 +24,16 @@ var _userDefault = {"cache": null}; var _userConfig = {"cache": null}; var _cacheExpired = false; var _cacheDays = 0; -var _dataPath = "../BetterDiscordData"; +var _dataPath; + +// OS specific _dataPath +var _os = process.platform; +if (_os == "win32") { + _dataPath = "../BetterDiscordData"; +} else if (_os == "darwin") { + _dataPath = "~/Library/Application Support/discord/BetterDiscordData"; +} + var _userFile = _dataPath + "/user.json"; function BetterDiscord(mainWindow) { @@ -74,7 +86,7 @@ BetterDiscord.prototype.init = function() { this.getUtils().log("Cache expired: " + _cacheExpired); //Get latest commit hash - this.getUtils().getHash(function(hash) { + this.getUtils().getHash(_beta, function(hash) { _hash = hash; self.getUtils().log("Latest Hash: " + _hash); //Get updater diff --git a/lib/Utils.js b/lib/Utils.js index 2dc16778..55a331a3 100644 --- a/lib/Utils.js +++ b/lib/Utils.js @@ -56,8 +56,9 @@ Utils.prototype.downloadHttp = function(url, callback) { }); } -Utils.prototype.getHash = function(callback) { - this.download("api.github.com", "/repos/Jiiks/BetterDiscordApp/commits/master", function(data) { +Utils.prototype.getHash = function(beta, callback) { + var branch = beta ? "beta" : "master"; + this.download("api.github.com", "/repos/Jiiks/BetterDiscordApp/commits/"+branch+"", function(data) { callback(JSON.parse(data).sha); }); }