Updates to proper path for data storage
This commit is contained in:
parent
587aeaadf5
commit
7098625460
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue