Different path handeling

This commit is contained in:
2023-01-04 09:50:29 +01:00
parent 0e0aef010f
commit 2589274f73
3 changed files with 28 additions and 11 deletions
+4 -3
View File
@@ -229,8 +229,9 @@
let workPath = document.getElementById("workPath");
// If empty or undefined use local folder as default
if (workPath.value == '' || workPath.value == undefined ) {
workPath.value = process.cwd();
// console.log("I am here",process.cwd());
// workPath.value = process.cwd();
workPath.value = '/tmp';
//app.setPath('temp',process.cwd());
}
// Catch calls for selectfolder
@@ -269,7 +270,6 @@
plotMean(filename);
});
// Catch clicks for Browse button
let browseBtn = document.getElementById('browseFolde');
ipcRenderer.on('browseFolder', function(event, foldername) {
if (foldername.length != 0) {
document.getElementById("workPath").value = foldername[0];
@@ -280,5 +280,6 @@
// Get the element with id="defaultOpen" and click on it
document.getElementById("btnLayers").click();
</script>
</html>
+3 -1
View File
@@ -53,10 +53,12 @@ C and maximum number of points in the depth distribution MAXD
& ,MAXD2meab
INTEGER MAXNL,MAXNL5,MAXNLp25,MAXNL5p2,MAXNLm15
C This is the only point where the number of layers and depth
C profile are changed. All other parameters shouold be changed
C profile are changed. All other parameters should be changed
C accordingly.
PARAMETER (MAXD=500)
PARAMETER (MAXNL=100)
C Maximum number of elements in each layer, was limited to 5.
PARAMETER (MAXEL=20)
PARAMETER (MAXD1=MAXD+1)
PARAMETER (MAXD2=MAXD+2)
PARAMETER (MAXD5=MAXD*5)
+21 -7
View File
@@ -19,11 +19,12 @@ function createWindow () {
submenu: [
{
label: 'Open',
id : 'openItem',
accelerator: 'CmdOrCtrl+O',
click () {
dialog.showOpenDialog(win,
{ title : "Load configuration file",
//defaultPath : "./",
defaultPath : app.getPath('temp'),
//buttonLabel : "Custom button",
filters :[
{name: 'Config file type', extensions: ['cfg']},
@@ -47,7 +48,7 @@ function createWindow () {
click () {
dialog.showOpenDialog(win,
{ title: "Select folder",
//defaultPath : "./",
defaultPath : app.getPath('temp'),
properties:["openDirectory"]}
).then(result => {
console.log(result.filePaths)
@@ -72,7 +73,7 @@ function createWindow () {
click () {
dialog.showSaveDialog(win,
{ title : "Save configuration file",
//defaultPath : "./",
defaultPath : app.getPath('temp'),
filters :[
{name: 'Config file type', extensions: ['cfg']},
{name: 'All Files', extensions: ['*']}
@@ -198,7 +199,7 @@ function createWindow () {
]
}
]
const menu = Menu.buildFromTemplate(template)
let menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
win.loadFile('TrimSP.html');
@@ -223,16 +224,29 @@ app.on('activate', () => {
})
// Reply to calls from browser button
ipcMain.on('browseFolder', (event) => {
ipcMain.on('browseFolder', (event, args) => {
console.log('received a message: '+args);
dialog.showOpenDialog({ title: "Select folder",
//defaultPath : "./",
defaultPath : app.getPath('temp'),
properties:["openDirectory"]}
).then(result => {
console.log(result.filePaths)
console.log(result)
var focusedWindow = BrowserWindow.getFocusedWindow();
focusedWindow.webContents.send('browseFolder',result.filePaths);
app.setPath('temp',result.filePaths[0]);
}).catch(err => {
console.log(err);
})
});
//ipcMain.on('browseFolder-send', (event, args) => {
// dialog.showOpenDialog(null, args).then(filePaths => {
// event.sender.dend('browseFolder', filePaths);
// }).catch(err => {
// console.log(err);
// })
//});
//menuItem = menu.getMenuItemById('openItem');
//console.log(menuItem);