diff --git a/app/main.js b/app/main.js index 6009345e..cd9f9aae 100644 --- a/app/main.js +++ b/app/main.js @@ -27,10 +27,6 @@ if (!process.env.TERMINUS_PLUGINS) { process.env.TERMINUS_PLUGINS = '' } -if (process.env.DEV) { - process.env.TERMINUS_PLUGINS += `:${path.resolve(__dirname, '..')}` -} - setupWindowManagement = () => { let windowCloseable diff --git a/app/src/plugins.ts b/app/src/plugins.ts index ef5837be..37eaae62 100644 --- a/app/src/plugins.ts +++ b/app/src/plugins.ts @@ -12,12 +12,20 @@ function normalizePath (path: string): string { }; (global).require.main.paths.map(x => nodeModule.globalPaths.push(normalizePath(x))) -nodeModule.globalPaths.unshift( - path.join( - path.dirname(require('electron').remote.app.getPath('exe')), - 'resources/builtin-plugins/node_modules', - ) -) + +if (process.env.DEV) { + nodeModule.globalPaths.unshift(path.dirname(require('electron').remote.app.getAppPath())) +} + +nodeModule.globalPaths.unshift(path.join( + path.dirname(require('electron').remote.app.getPath('exe')), + 'resources/builtin-plugins/node_modules', +)) +nodeModule.globalPaths.unshift(path.join( + require('electron').remote.app.getPath('appData'), + 'terminus', + 'plugins', +)) if (process.env.TERMINUS_PLUGINS) { process.env.TERMINUS_PLUGINS.split(':').map(x => nodeModule.globalPaths.unshift(normalizePath(x))) @@ -47,6 +55,11 @@ export async function findPlugins (): Promise { if (!await fs.exists(infoPath)) { continue } + + if (foundPlugins.some(x => x.name === pluginName)) { + console.info(`Plugin ${pluginName} already exists`) + } + try { foundPlugins.push({ name: pluginName,