Updates to proper path for data storage

This commit is contained in:
Zack Rauen 2020-07-26 20:54:58 -04:00
parent 587aeaadf5
commit 7098625460
1 changed files with 1 additions and 3 deletions

View File

@ -9,6 +9,7 @@ let dataPath = "";
if (process.platform === "win32") dataPath = process.env.APPDATA;
else if (process.platform === "darwin") dataPath = path.join(process.env.HOME, "Library", "Preferences");
else dataPath = path.join(process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : process.env.HOME, ".config");
dataPath = path.join(dataPath, "BetterDiscord");
export default new class DataStore {
constructor() {
@ -18,9 +19,6 @@ export default new class DataStore {
initialize() {
try {
if (!fs.existsSync(dataPath)) fs.mkdirSync(dataPath);
if (!fs.existsSync(path.join(dataPath, "plugins"))) fs.mkdirSync(path.join(dataPath, "plugins"));
if (!fs.existsSync(path.join(dataPath, "themes"))) fs.mkdirSync(path.join(dataPath, "themes"));
if (!fs.existsSync(this.BDFile)) fs.writeFileSync(this.BDFile, JSON.stringify(this.data, null, 4));
const data = __non_webpack_require__(this.BDFile);
if (data.hasOwnProperty("settings")) this.data = data;