diff --git a/src/index.js b/src/index.js index 8bca90c..e79da0c 100644 --- a/src/index.js +++ b/src/index.js @@ -13,7 +13,7 @@ global.oaConfig = require('./appSettings').getSettings().get('openasar', {}); require('./cmdSwitches')(); if (process.argv.includes('--overlay-host')) { // If overlay - require('./utils/u2LoadModulePath')(); // Manually load updater 2 module paths (all modules) + require('./utils/u2QuickLoad'); // Manually load updater 2 module paths (all modules) require('discord_overlay2/standalone_host.js'); // Start overlay } else { require('./bootstrap')(); // Start bootstrap diff --git a/src/splash/index.js b/src/splash/index.js index e3f39b1..909090d 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -35,9 +35,7 @@ exports.initSplash = (startMinimized = false) => { if (process.env.OPENASAR_QUICKSTART || oaConfig.quickstart) setTimeout(() => { destroySplash(); - if (newUpdater != null) { // Manually load desktop_core module path for faster requiring - require('../utils/u2LoadModulePath')(); - } + if (newUpdater != null) require('../utils/u2QuickLoad'); // Manually load desktop_core module path for faster requiring launchMainWindow(); diff --git a/src/utils/u2LoadModulePath.js b/src/utils/u2LoadModulePath.js deleted file mode 100644 index a29cf48..0000000 --- a/src/utils/u2LoadModulePath.js +++ /dev/null @@ -1,17 +0,0 @@ -const { readdirSync } = require('fs'); -const { join } = require('path'); -const NodeModule = require('module'); - -const paths = require('../paths'); - - -module.exports = (moduleName) => { - const modulesDir = join(paths.getExeDir(), 'modules'); - const moduleDirs = readdirSync(modulesDir); - - if (moduleName) return NodeModule.globalPaths.push(join(modulesDir, moduleDirs.find((x) => x.startsWith(moduleName + '-')))); // Specific - - for (const dir of moduleDirs) { // General (load all) - NodeModule.globalPaths.push(join(modulesDir, dir)); - } -}; \ No newline at end of file diff --git a/src/utils/u2QuickLoad.js b/src/utils/u2QuickLoad.js new file mode 100644 index 0000000..0943422 --- /dev/null +++ b/src/utils/u2QuickLoad.js @@ -0,0 +1,13 @@ +const { readdirSync } = require('fs'); +const { join } = require('path'); +const Module = require('module'); + +const paths = require('../paths'); + + +const modulesDir = join(paths.getExeDir(), 'modules'); +const moduleDirs = readdirSync(modulesDir); + +for (const dir of moduleDirs) { // General (load all) + Module.globalPaths.push(join(modulesDir, dir)); +} \ No newline at end of file