Fixes issues with bd folder

This commit is contained in:
Zack Rauen 2021-03-25 12:19:55 -04:00
parent f3f15ec72c
commit bd9b681e3f
2 changed files with 5 additions and 3 deletions

View File

@ -11,9 +11,8 @@ const buildInfoFile = path.resolve(appPath, "..", "build_info.json");
// Locate data path to find transparency settings
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 = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : path.join(process.env.HOME, ".config");
if (process.platform === "win32" || process.platform === "darwin") dataPath = path.join(electron.app.getPath("userData"), "..");
else dataPath = process.env.XDG_CONFIG_HOME ? process.env.XDG_CONFIG_HOME : path.join(process.env.HOME, ".config"); // This will help with snap packages eventually
dataPath = path.join(dataPath, "BetterDiscord") + "/";

View File

@ -26,6 +26,9 @@ export default new class DataStore {
}
initialize() {
const bdFolderExists = fs.existsSync(Config.dataPath);
if (!bdFolderExists) fs.mkdirSync(Config.dataPath);
const newStorageExists = fs.existsSync(this.baseFolder);
if (!newStorageExists) fs.mkdirSync(this.baseFolder);