Browse Source

Load all main process files

Loquicom 5 years ago
parent
commit
61202d9f11
1 changed files with 12 additions and 2 deletions
  1. 12 2
      main.js

+ 12 - 2
main.js

@@ -48,8 +48,11 @@ async function main() {
   }
   // Edit launch info file
   file.put(path.join(__dirname, '/data/launch-info.json'), JSON.stringify(launchInfo));
-  // Compile SCSS file from app
-  if (!program.src) { 
+  // if launch the advanced electron app
+  if (!program.src) {
+    // Loading main process files
+    loadMainProcessFiles();
+    // Compile SCSS file from app
     console.info('Compiling SCSS files in CSS');
     let scssFile = path.join(__dirname, folder, 'src/css/style.scss');
     let cssFile = path.join(__dirname, folder, 'src/css/style.min.css');
@@ -75,6 +78,13 @@ function createMainWindow(simple = false) {
   });
 }
 
+function loadMainProcessFiles() {
+  const mainProcessFiles = file.list(path.join(__dirname, folder, 'main/'));
+  mainProcessFiles.forEach(f => {
+    require(path.join(__dirname, folder, 'main/', f));
+  });
+}
+
 /* --- Electron app actions --- */
 
 // This method will be called when Electron is ready