Move _dataPath assignment to init function to fix invalid path errors

This commit is contained in:
Jiiks 2015-11-03 00:29:26 +02:00
parent 8f37203561
commit 713c11248d
1 changed files with 17 additions and 12 deletions

View File

@ -5,15 +5,16 @@
* Last Update: 25/10/2015 - 23:48 * Last Update: 25/10/2015 - 23:48
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
*/ */
//Imports
var _fs = require("fs"); var _fs = require("fs");
var _config = require("./config.json"); var _config = require("./config.json");
var _utils = require("./utils"); var _utils = require("./utils");
//Use beta javascript
var _beta = false;
var _ipc = require('ipc'); var _ipc = require('ipc');
//Beta flag
var _beta = false;
var _version; var _version;
var _mainWindow; var _mainWindow;
var _updater; var _updater;
@ -25,15 +26,10 @@ var _cacheExpired = false;
var _cacheDays = 0; var _cacheDays = 0;
var _dataPath; 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"; var _os = process.platform;
var _userfile;
function BetterDiscord(mainWindow) { function BetterDiscord(mainWindow) {
_mainWindow = mainWindow; _mainWindow = mainWindow;
@ -47,6 +43,15 @@ BetterDiscord.prototype.getUtils = function() {
BetterDiscord.prototype.init = function() { BetterDiscord.prototype.init = function() {
//OS specific _dataPath
if (_os == "win32") {
_dataPath = "../BetterDiscordData";
} else if (_os == "darwin") {
_dataPath = "~/Library/Application Support/discord/BetterDiscordData";
}
_userFile = _dataPath + "/user.json";
var self = this; var self = this;
//Check emotedata cache //Check emotedata cache