Merge pull request #181 from JsSucks/css-editor-path

Dist path for css editor
This commit is contained in:
Alexei Stukov 2018-03-19 18:28:53 -03:00 committed by GitHub
commit 86fc492af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

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

View File

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