Rework of loading the index file.
This commit is contained in:
26
index.js
26
index.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user