From eed634217ef34ee31e8f80de2957f473f2229085 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 19 Mar 2018 18:26:13 -0300 Subject: [PATCH] Dist path for css editor --- core/src/main.js | 8 ++++++-- core/src/modules/csseditor.js | 15 ++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core/src/main.js b/core/src/main.js index 2c2b16d2..e92aa0b2 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -27,6 +27,9 @@ const _extPath = tests const _pluginPath = path.resolve(_extPath, 'plugins'); const _themePath = path.resolve(_extPath, 'themes'); const _modulePath = path.resolve(_extPath, 'modules'); +const _cssEditorPath = tests + ? path.resolve(__dirname, '..', '..', '..', 'csseditor', 'dist') + : path.resolve(__dirname, 'csseditor'); const paths = [ { id: 'cs', path: _clientScript.replace(/\\/g, '/') }, @@ -34,7 +37,8 @@ const paths = [ { id: 'ext', path: _extPath.replace(/\\/g, '/') }, { id: 'plugins', path: _pluginPath.replace(/\\/g, '/') }, { id: 'themes', path: _themePath.replace(/\\/g, '/') }, - { id: 'modules', path: _modulePath.replace(/\\/g, '/') } + { id: 'modules', path: _modulePath.replace(/\\/g, '/') }, + { id: 'csseditor', path: _cssEditorPath.replace(/\\/g, '/') } ]; const sparkplug = path.resolve(__dirname, 'sparkplug.js').replace(/\\/g, '/'); @@ -138,7 +142,7 @@ class BetterDiscord { const window = await this.waitForWindow(); this.windowUtils = new WindowUtils({ window }); - this.csseditor = new CSSEditor(this); + this.csseditor = new CSSEditor(this, paths.find(path => path.id === 'csseditor').path); this.windowUtils.events('did-get-response-details', () => this.ignite(this.windowUtils.window)); this.windowUtils.events('did-finish-load', e => this.injectScripts(true)); diff --git a/core/src/modules/csseditor.js b/core/src/modules/csseditor.js index 9355ccd3..a70274a9 100644 --- a/core/src/modules/csseditor.js +++ b/core/src/modules/csseditor.js @@ -16,8 +16,9 @@ const { WindowUtils } = require('./utils'); class CSSEditor extends Module { - constructor(bd) { + constructor(bd, path) { super(); + this.editorPath = path; this.bd = bd; } @@ -33,7 +34,9 @@ class CSSEditor extends Module { const options = this.options; for (let option in o.args) { - options[option] = o.args[option]; + if (o.args.hasOwnProperty(option)) { + options[option] = o.args[option]; + } } this.editor = new BrowserWindow(options); @@ -78,13 +81,7 @@ class CSSEditor extends Module { frame: false }; } - - //TODO Currently uses a development path - get editorPath() { - return path.resolve(__dirname, '..', '..', '..', 'csseditor', 'dist'); - // return path.resolve(__dirname, '..', '..', '..', 'tests', 'csseditor'); - } - + } module.exports = { CSSEditor };