Use app path to determine where trimspNL binary is.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
const fs = require('fs');
|
||||
const exec = require('child_process').execSync;
|
||||
const remote = require('electron').remote;
|
||||
</script>
|
||||
|
||||
<title>Trim.SP</title>
|
||||
@@ -32,7 +33,10 @@
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
<td><label>File name prefix:</label></td>
|
||||
<td><input name="fileNamePrefix" id="fileNamePrefix" type="text" style="width:70%" value="SrTiO3"/></td>
|
||||
<td>
|
||||
<input name="fileNamePrefix" id="fileNamePrefix" type="text" style="width:70%" value="SrTiO3"/>
|
||||
<input name="trimPath" id="trimPath" type="text" style="width:70%;visibility:hidden;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>Save folder:</label></td>
|
||||
@@ -208,6 +212,8 @@
|
||||
</table>
|
||||
</body>
|
||||
<script>
|
||||
document.getElementById("trimPath").value = remote.getGlobal('path');
|
||||
|
||||
// Catch calls for open file
|
||||
ipcRenderer.on('openFile', function(event, filename) {
|
||||
console.log('Open file '+filename);
|
||||
|
||||
@@ -54,10 +54,3 @@ function readAsciiFile(filename) {
|
||||
return(content);
|
||||
}
|
||||
|
||||
function appPath() {
|
||||
// return the path where the app resides
|
||||
// let path = require('app').getAppPath();
|
||||
// console.log(path);
|
||||
let path = "./";
|
||||
return path;
|
||||
}
|
||||
|
||||
11
TrimSPlib.js
11
TrimSPlib.js
@@ -707,6 +707,7 @@ function prep_cfg(toggle) {
|
||||
let valtmp = "";
|
||||
|
||||
let All = new Object();
|
||||
All['trimPath']=document.getElementById("trimPath").value;
|
||||
|
||||
// Prepare Layers section
|
||||
let LayersSec = "[Layers]\n";
|
||||
@@ -932,7 +933,8 @@ function sum(array){
|
||||
|
||||
function startSequence(All) {
|
||||
let cmd = '';
|
||||
|
||||
let trimBin = All['trimPath']+"/trimspNL";
|
||||
|
||||
// Check if workPath exists otherwise create it
|
||||
checkDir(All['workPath']); // from TrimSPelec.js, Electron/Node specific
|
||||
|
||||
@@ -994,10 +996,7 @@ function startSequence(All) {
|
||||
// Use Linux version
|
||||
Progress=Progress+90/SValues.length;
|
||||
// Update GUI progress bar
|
||||
let path = process.env.PWD;
|
||||
cmd = "cd "+All["workPath"]+";cp "+FILENAME+".inp eingabe1.inp;trimspNL"; // Or use $ENV{'TRIMBIN'};
|
||||
// document.getElementById("myBar").style.width = Progress + "%";
|
||||
// document.getElementById("myBar").innerHTML = Progress + "%";
|
||||
cmd = "cd "+All["workPath"]+";cp "+FILENAME+".inp eingabe1.inp;"+trimBin;
|
||||
// Execute command
|
||||
execute(cmd);
|
||||
|
||||
@@ -1046,7 +1045,7 @@ function startSequence(All) {
|
||||
Progress=20;
|
||||
// Update progress on GUI
|
||||
let path = process.env.PWD;
|
||||
cmd = "cd "+All["workPath"]+";cp "+FILENAME+".inp eingabe1.inp;trimspNL"; // Or use $ENV{'TRIMBIN'};
|
||||
cmd = "cd "+All["workPath"]+";cp "+FILENAME+".inp eingabe1.inp;"+trimBin;
|
||||
execute(cmd);
|
||||
// document.getElementById("myBar").style.width = Progress + "%";
|
||||
// document.getElementById("myBar").innerHTML = Progress + "%";
|
||||
|
||||
6
main.js
6
main.js
@@ -7,7 +7,8 @@ function createWindow () {
|
||||
icon: "./appicons/icons/png/1024x1024.png",
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
nativeWindowOpen: true
|
||||
nativeWindowOpen: true,
|
||||
enableRemoteModule: true,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -206,7 +207,8 @@ function createWindow () {
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
console.log(app.getAppPath());
|
||||
global.path = app.getAppPath();
|
||||
//console.log("From main: ",global.path);
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
|
||||
Reference in New Issue
Block a user