1- const path = require ( "path" ) ;
21require ( "./providers/front-logger" ) ( ) ;
32const config = require ( "./config" ) ;
43const { fileExists } = require ( "./plugins/utils" ) ;
@@ -10,14 +9,26 @@ const plugins = config.plugins.getEnabled();
109
1110let api ;
1211
13- plugins . forEach ( ( [ plugin , options ] ) => {
14- const preloadPath = path . join ( __dirname , "plugins" , plugin , "preload.js" ) ;
12+ plugins . forEach ( async ( [ plugin , options ] ) => {
13+ const preloadPath = await ipcRenderer . invoke (
14+ "getPath" ,
15+ __dirname ,
16+ "plugins" ,
17+ plugin ,
18+ "preload.js"
19+ ) ;
1520 fileExists ( preloadPath , ( ) => {
1621 const run = require ( preloadPath ) ;
1722 run ( options ) ;
1823 } ) ;
1924
20- const actionPath = path . join ( __dirname , "plugins" , plugin , "actions.js" ) ;
25+ const actionPath = await ipcRenderer . invoke (
26+ "getPath" ,
27+ __dirname ,
28+ "plugins" ,
29+ plugin ,
30+ "actions.js"
31+ ) ;
2132 fileExists ( actionPath , ( ) => {
2233 const actions = require ( actionPath ) . actions || { } ;
2334
@@ -30,8 +41,14 @@ plugins.forEach(([plugin, options]) => {
3041} ) ;
3142
3243document . addEventListener ( "DOMContentLoaded" , ( ) => {
33- plugins . forEach ( ( [ plugin , options ] ) => {
34- const pluginPath = path . join ( __dirname , "plugins" , plugin , "front.js" ) ;
44+ plugins . forEach ( async ( [ plugin , options ] ) => {
45+ const pluginPath = await ipcRenderer . invoke (
46+ "getPath" ,
47+ __dirname ,
48+ "plugins" ,
49+ plugin ,
50+ "front.js"
51+ ) ;
3552 fileExists ( pluginPath , ( ) => {
3653 const run = require ( pluginPath ) ;
3754 run ( options ) ;
0 commit comments