From f3ea1929742354b61c16951b310024ccec881583 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sun, 17 Feb 2019 12:18:16 +0200 Subject: [PATCH] Paths compatibility --- core/src/main.js | 1 + core/src/modules/config.js | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main.js b/core/src/main.js index d7581000..914abede 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -143,6 +143,7 @@ export class BetterDiscord { BetterDiscord.loaded = true; this._args = args; + this.config.compatibility(); this.bindings(); this.parseClientPackage(); diff --git a/core/src/modules/config.js b/core/src/modules/config.js index 2eb1c2dc..2de5839d 100644 --- a/core/src/modules/config.js +++ b/core/src/modules/config.js @@ -29,13 +29,12 @@ export default class Config extends Module { } getPath(id, full) { - return this.paths[id]; - // const path = this.paths.find(path => path.id === id); - // return full ? path : path.path; + const path = this.paths.find(p => p.id === id); + return full ? path : path.path; } addPath(id, path) { - this.paths[id] = path; + this.paths.push({ id, path }); } get config() { @@ -45,4 +44,8 @@ export default class Config extends Module { }; } + // Compatibility with old client code and new installer args + compatibility() { + this.args.paths = Object.entries(this.args.paths).map(([id, path]) => ({ id, path })); + } }