[Index] Simplify system electron and overlay source

This commit is contained in:
Ducko 2022-02-13 21:30:05 +00:00
parent 2ca57c8f6b
commit 4955f5f8cf

View file

@ -4,15 +4,8 @@ global.oaVersion = 'nightly';
log('Init', 'OpenAsar', oaVersion); log('Init', 'OpenAsar', oaVersion);
log('Init', 'Resources Path:', process.resourcesPath); if (process.resourcesPath.startsWith('/usr/lib/electron')) global.systemElectron = true; // Using system electron, flag for other places
if (process.resourcesPath.startsWith('/usr/lib/electron')) { // Using system electron, fix process.resourcesPath process.resourcesPath = require('path').join(__dirname, '..'); // Force resourcesPath for system electron
log('Init', 'Detected System Electron, fixing paths');
global.systemElectron = true;
process.resourcesPath = require('path').join(__dirname, '..');
log('Init', 'Resources Path:', process.resourcesPath);
}
const appSettings = require('./appSettings'); const appSettings = require('./appSettings');
global.oaConfig = appSettings.getSettings().get('openasar', {}); global.oaConfig = appSettings.getSettings().get('openasar', {});
@ -21,16 +14,9 @@ log('Init', 'Loaded config', oaConfig);
require('./cmdSwitches')(); require('./cmdSwitches')();
if (process.argv.includes('--overlay-host')) { if (process.argv.includes('--overlay-host')) { // If overlay
const buildInfo = require('./utils/buildInfo'); require('./utils/u2LoadModulePath')(); // Manually load updater 2 module paths (all modules)
require('discord_overlay2/standalone_host.js'); // Start overlay
if (buildInfo.newUpdater) {
require('./utils/u2LoadModulePath')();
} else {
require('./updater/moduleUpdater').initPathsOnly(buildInfo);
}
require('discord_overlay2/standalone_host.js');
} else { } else {
require('./bootstrap')(); // Start bootstrap require('./bootstrap')(); // Start bootstrap
} }