Rework of loading the index file.

This commit is contained in:
Scott Idem
2022-10-15 23:10:54 -04:00
parent 2d27750d0e
commit 040ab4aa4e
6 changed files with 425 additions and 120 deletions

View File

@@ -19,7 +19,21 @@ console.log('Home: '+home_directory);
let tmp_directory = require('os').tmpdir();
console.log('Temporary: '+tmp_directory);
let config = null;
// Set the config path for macOS or Linux
let config_directory = null;
if (os.platform == 'darwin') {
config_directory = path.join(home_directory, 'Library/Application Support/OSIT');
console.log('macOS config directory: '+config_directory);
} else if (os.platform == 'linux') {
config_directory = path.join(home_directory, '.config/OSIT');
console.log('Linux config directory: '+config_directory);
}
let config_path = path.join(config_directory, 'config.json');
// let config = null;
let config = JSON.parse(fs.readFileSync(config_path));
console.log('Config file read.', config);
let local_file_cache_path = null;
let host_file_temp_path = null;
@@ -68,7 +82,15 @@ function createWindow () {
// win.webContents.session.clearStorageData(['filesystem']); // Does this do anything???
// and load the index.html of the app.
win.loadFile('app/index.html');
if (config.native_app_js_css_option == '' || config.native_app_js_css_option == 'default') {
win.loadFile('app/index.html');
} else if (config.native_app_js_css_option == 'development') {
win.loadFile('app/index_development.html');
} else if (config.native_app_js_css_option == 'onsite') {
win.loadFile('app/index_onsite.html');
} else {
win.loadFile('app/index.html');
}
// Open the DevTools.
win.webContents.openDevTools(); // Comment out for production