diff --git a/TrimSP.html b/TrimSP.html
index 62d3d0f..ca8f257 100644
--- a/TrimSP.html
+++ b/TrimSP.html
@@ -41,7 +41,7 @@
|
-
+
|
@@ -226,13 +226,21 @@
});
});
- let foldername = document.getElementById("workPath").value;
- // If empty or undefined fill with default
- if (foldername == '' || foldername == undefined ) {foldername ="/tmp/test";}
+ 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());
+ }
// Catch calls for selectfolder
ipcRenderer.on('selectFolder', function(event, foldername) {
- document.getElementById("workPath").value = foldername;
+ if (foldername.length != 0) {
+ document.getElementById("workPath").value = foldername[0];
+ // Change process directory
+ process.chdir(foldername[0]);
+ }
+ console.log("currentdir",process.cwd());
});
// Catch calls for save as
ipcRenderer.on('saveFile', function(event, filename) {
@@ -263,8 +271,11 @@
// Catch clicks for Browse button
let browseBtn = document.getElementById('browseFolde');
ipcRenderer.on('browseFolder', function(event, foldername) {
- document.getElementById("workPath").value = foldername;
- console.log("foldername="+foldername);
+ if (foldername.length != 0) {
+ document.getElementById("workPath").value = foldername[0];
+ // Change process directory
+ process.chdir(foldername[0]);
+ }
});
// Get the element with id="defaultOpen" and click on it
diff --git a/TrimSPlib.js b/TrimSPlib.js
index a383f23..32ff5b6 100644
--- a/TrimSPlib.js
+++ b/TrimSPlib.js
@@ -853,7 +853,7 @@ function CreateInpFile(All) {
let rho = 1*All[Lrho];
// How to do this? All[Lrho]=sprintf("%6.2f",rho);
- if (rho=="") {Check++;console.log("rho",rho);}
+ if (rho=="") {Check++;}
// Thickness of layers
let Ld ="L"+i+"d";
@@ -876,7 +876,6 @@ function CreateInpFile(All) {
Sum=Sum+LElComp[key];
}
if (Sum==0) {Sum=1;}
- console.log("Sum=",Sum);
let Els = Object.keys(LElComp);
diff --git a/main.js b/main.js
index 04862b5..86c268f 100644
--- a/main.js
+++ b/main.js
@@ -1,5 +1,4 @@
const { app, BrowserWindow, Menu, dialog, ipcMain, fs } = require('electron');
-
function createWindow () {
const win = new BrowserWindow({
width: 950,
@@ -14,7 +13,7 @@ function createWindow () {
})
- const template = [
+ let template = [
{
label: 'File',
submenu: [
@@ -24,7 +23,7 @@ function createWindow () {
click () {
dialog.showOpenDialog(win,
{ title : "Load configuration file",
- defaultPath : "./",
+ //defaultPath : "./",
//buttonLabel : "Custom button",
filters :[
{name: 'Config file type', extensions: ['cfg']},
@@ -48,7 +47,7 @@ function createWindow () {
click () {
dialog.showOpenDialog(win,
{ title: "Select folder",
- defaultPath : "./",
+ //defaultPath : "./",
properties:["openDirectory"]}
).then(result => {
console.log(result.filePaths)
@@ -73,7 +72,7 @@ function createWindow () {
click () {
dialog.showSaveDialog(win,
{ title : "Save configuration file",
- defaultPath : "./",
+ //defaultPath : "./",
filters :[
{name: 'Config file type', extensions: ['cfg']},
{name: 'All Files', extensions: ['*']}
@@ -226,7 +225,7 @@ app.on('activate', () => {
// Reply to calls from browser button
ipcMain.on('browseFolder', (event) => {
dialog.showOpenDialog({ title: "Select folder",
- defaultPath : "./",
+ //defaultPath : "./",
properties:["openDirectory"]}
).then(result => {
console.log(result.filePaths)