mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
Sync with rauenzi/BetterDiscordApp 7098625
Updates to proper path for data storage
This commit is contained in:
parent
986ec9ad88
commit
e1cd3984f1
6
BetterDiscordApp/dist/index.js
vendored
6
BetterDiscordApp/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -12,6 +12,7 @@ let dataPath = "";
|
|||||||
if (process.platform === "win32") dataPath = process.env.APPDATA;
|
if (process.platform === "win32") dataPath = process.env.APPDATA;
|
||||||
else if (process.platform === "darwin") dataPath = path.join(process.env.HOME, "Library", "Preferences");
|
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");
|
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 {
|
export default new class DataStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -22,9 +23,6 @@ export default new class DataStore {
|
|||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
try {
|
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), "binary");
|
if (!fs.existsSync(this.BDFile)) fs.writeFileSync(this.BDFile, JSON.stringify(this.data, null, 4), "binary");
|
||||||
const data = JSON.parse(fs.readFileSync(this.BDFile, "binary"))
|
const data = JSON.parse(fs.readFileSync(this.BDFile, "binary"))
|
||||||
if (data.hasOwnProperty("settings")) this.data = data;
|
if (data.hasOwnProperty("settings")) this.data = data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user