Improved args parsing in and out of AppImage
This commit is contained in:
@@ -9,37 +9,6 @@ const { newton } = require('./app');
|
||||
|
||||
|
||||
|
||||
let startType = "";
|
||||
let isDebug = false;
|
||||
let args = [];
|
||||
|
||||
|
||||
|
||||
const loadArgs = () => {
|
||||
console.log("\n\nStart KArgs:");
|
||||
const hasStartAs = app.commandLine.hasSwitch("start-as");
|
||||
if (hasStartAs) {
|
||||
startType = app.commandLine.getSwitchValue("start-as");
|
||||
console.log("Has start-as switch...");
|
||||
console.log(startType);
|
||||
}
|
||||
|
||||
const hasDebug = app.commandLine.hasSwitch("app-debug");
|
||||
if (hasDebug) {
|
||||
isDebug = app.commandLine.getSwitchValue("app-debug");
|
||||
console.log("Has app-debug switch...");
|
||||
console.log(isDebug);
|
||||
}
|
||||
|
||||
console.log("\n\nStart VArgs:");
|
||||
args = process.argv.slice(4); // remove up to --start-as ...
|
||||
args.forEach((val, index, array) => {
|
||||
console.log(index + ': ' + val);
|
||||
});
|
||||
|
||||
console.log("\n\n");
|
||||
}
|
||||
|
||||
const loadHandlers = () => {
|
||||
ipcMain.handle('getLspConfigData', (eve) => newton.fs.getLspConfigData());
|
||||
ipcMain.handle('getFileContents', (eve, file) => newton.fs.getFileContents(file));
|
||||
@@ -50,17 +19,25 @@ const loadHandlers = () => {
|
||||
|
||||
|
||||
app.whenReady().then(() => {
|
||||
loadArgs();
|
||||
newton.args.loadArgs();
|
||||
loadHandlers();
|
||||
|
||||
newton.settings.loadsettings();
|
||||
let window = newton.createWindow(startType, isDebug, args);
|
||||
let window = newton.createWindow(
|
||||
newton.args.getStartType(),
|
||||
newton.args.debugMode(),
|
||||
newton.args.getArgs(),
|
||||
);
|
||||
newton.fs.setWindow(window);
|
||||
});
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
newton.createWindow(startType, isDebug, args);
|
||||
newton.createWindow(
|
||||
newton.args.getStartType(),
|
||||
newton.args.debugMode(),
|
||||
newton.args.getArgs(),
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user