Read paths from Global

This commit is contained in:
Jiiks 2018-01-16 07:13:36 +02:00
parent 7fd368f936
commit 98d58b1303
3 changed files with 27850 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

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

2
core/dist/main.js vendored
View File

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