Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If the application was loaded as a launcher...
if(runtime.arguments.launcher) {
debug.log('Running dolphin launcher...');
// Run the launcher's file in the global's context
system.loadScript(runtime.path + '/launcher.js', () => {
debug.error(tr('Failed to load the launcher file'));
});
} else {
/** The translation package path
* @type {string} */
// NOTE: We load the translation only here because the launcher will have
// to load it by itself (translations are not synchronous between
// main and child processes)
let tr_path = fs.makeAbsolute('translations/' + translate.language + '.ntp');
// If the translation was not loaded and a package exists for this language...
if(!translate.loaded(tr_path) && fs.fileExists(tr_path) === true) {
// Load the translation package
error = translate.load(translate.language, tr_path);
// If an error occured
if(e(error))
// Make it fatal
debug.error(`Failed to load the translation package for "${translate.language}"`, error);
}
/** The dolphin's explorer file
* @type {string|NightError} */
let content = fs.readFile('explorer.js');
// If the reading failed...
} else {
/** The translation package path
* @type {string} */
// NOTE: We load the translation only here because the launcher will have
// to load it by itself (translations are not synchronous between
// main and child processes)
let tr_path = fs.makeAbsolute('translations/' + translate.language + '.ntp');
// If the translation was not loaded and a package exists for this language...
if(!translate.loaded(tr_path) && fs.fileExists(tr_path) === true) {
// Load the translation package
error = translate.load(translate.language, tr_path);
// If an error occured
if(e(error))
// Make it fatal
debug.error(`Failed to load the translation package for "${translate.language}"`, error);
}
/** The dolphin's explorer file
* @type {string|NightError} */
let content = fs.readFile('explorer.js');
// If the reading failed...
if(e(content))
// Make it fatal
debug.error(tr('Failed to load the explorer script'), content);
// Run the explorer file
eval(content);
}