2022-04-05 12:13:55 +00:00
|
|
|
const { join } = require('path');
|
|
|
|
|
2022-04-27 18:37:38 +00:00
|
|
|
global.log = (area, ...args) => console.log(`[\x1b[38;2;88;101;242mOpenAsar\x1b[0m > ${area}]`, ...args); // Make log global for easy usage everywhere
|
2022-03-28 07:14:13 +00:00
|
|
|
|
2021-12-11 20:09:43 +00:00
|
|
|
global.oaVersion = 'nightly';
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2022-02-13 20:52:19 +00:00
|
|
|
log('Init', 'OpenAsar', oaVersion);
|
2021-12-09 19:27:06 +00:00
|
|
|
|
2022-02-13 21:30:05 +00:00
|
|
|
if (process.resourcesPath.startsWith('/usr/lib/electron')) global.systemElectron = true; // Using system electron, flag for other places
|
2022-04-05 12:13:55 +00:00
|
|
|
process.resourcesPath = join(__dirname, '..'); // Force resourcesPath for system electron
|
2021-12-22 19:06:57 +00:00
|
|
|
|
2022-04-05 12:13:55 +00:00
|
|
|
const paths = require('./paths');
|
|
|
|
paths.init();
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2022-04-05 07:35:57 +00:00
|
|
|
global.settings = require('./appSettings').getSettings();
|
|
|
|
global.oaConfig = settings.get('openasar', {});
|
2022-04-05 12:13:55 +00:00
|
|
|
|
2021-12-21 10:38:18 +00:00
|
|
|
require('./cmdSwitches')();
|
|
|
|
|
2022-04-12 21:42:57 +00:00
|
|
|
|
2022-04-05 12:13:55 +00:00
|
|
|
// Force u2QuickLoad (pre-"minified" ish)
|
|
|
|
const M = require('module'); // Module
|
|
|
|
|
|
|
|
const b = join(paths.getExeDir(), 'modules'); // Base dir
|
2022-06-27 07:00:16 +00:00
|
|
|
if (process.platform === 'win32') try {
|
|
|
|
for (const m of require('fs').readdirSync(b)) M.globalPaths.push(join(b, m)); // For each module dir, add to globalPaths
|
|
|
|
} catch { log('Init', 'Failed to QS globalPaths') }
|
2022-04-05 12:13:55 +00:00
|
|
|
|
|
|
|
|
2022-02-13 21:30:05 +00:00
|
|
|
if (process.argv.includes('--overlay-host')) { // If overlay
|
2022-04-02 21:23:19 +00:00
|
|
|
require('./utils/requireNative')('discord_overlay2', 'standalone_host.js'); // Start overlay
|
2021-12-12 14:41:15 +00:00
|
|
|
} else {
|
2022-02-13 20:52:19 +00:00
|
|
|
require('./bootstrap')(); // Start bootstrap
|
|
|
|
}
|