Paths compatibility

This commit is contained in:
Jiiks 2019-02-17 12:18:16 +02:00
parent 9c1a93f4c1
commit f3ea192974
2 changed files with 8 additions and 4 deletions

View File

@ -143,6 +143,7 @@ export class BetterDiscord {
BetterDiscord.loaded = true;
this._args = args;
this.config.compatibility();
this.bindings();
this.parseClientPackage();

View File

@ -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 }));
}
}