Read paths from Global
This commit is contained in:
parent
7fd368f936
commit
98d58b1303
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@
|
|||
const { Module } = require('./modulebase');
|
||||
const { BDIpc } = require('./bdipc');
|
||||
const { Utils, FileUtils } = require('./utils');
|
||||
const { Global } = require('./global');
|
||||
const fs = window.require('fs');
|
||||
const path = window.require('path');
|
||||
|
||||
|
@ -47,17 +48,15 @@ class PluginManager extends Module {
|
|||
return this.state.plugins;
|
||||
}
|
||||
|
||||
async pluginsPath() {
|
||||
//TODO Get this from config module
|
||||
const config = await BDIpc.send('getConfig');
|
||||
return config.paths.find(path => 'plugins' in path).plugins;
|
||||
pluginsPath() {
|
||||
return Global.getObject('paths').find(path => path.id === 'plugins').path;
|
||||
}
|
||||
|
||||
async loadPlugin(pluginPath) {
|
||||
const { plugins } = this.state;
|
||||
|
||||
try {
|
||||
const pluginsPath = await this.pluginsPath();
|
||||
const pluginsPath = this.pluginsPath();
|
||||
pluginPath = path.join(pluginsPath, pluginPath);
|
||||
|
||||
const loaded = plugins.find(plugin => plugin.pluginPath === pluginPath);
|
||||
|
|
|
@ -34,7 +34,7 @@ const Common = {};
|
|||
|
||||
const dummyArgs = {
|
||||
'version': '0.3.1',
|
||||
'paths': [{ 'base': 'basePath' }, { 'plugins': __pluginPath }, { 'themes': __themePath }]
|
||||
'paths': [{ 'id': 'base', 'path': 'basePath' }, { 'id': 'plugins', 'path': __pluginPath }, { 'id': 'themes', 'path': __themePath }]
|
||||
};
|
||||
|
||||
console.log(dummyArgs);
|
||||
|
|
Loading…
Reference in New Issue