Fix regressions
This commit is contained in:
@@ -46,6 +46,10 @@ function getParallelJobCount() {
|
||||
|
||||
function checkDir(directory) {
|
||||
// Check whether directory exists, if not create it
|
||||
if (typeof directory !== 'string' || directory.length === 0) {
|
||||
console.log('Invalid directory passed to checkDir:', directory);
|
||||
return(0);
|
||||
}
|
||||
if (!fs.existsSync(directory)) {
|
||||
// Folder does not exist try to create it
|
||||
fs.mkdir(directory,{recursive: true}, (err) => {
|
||||
@@ -83,6 +87,9 @@ function readAsciiFile(filename) {
|
||||
}
|
||||
|
||||
function fileExists(filename) {
|
||||
if (typeof filename !== 'string' || filename.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
if (fs.existsSync(filename)) {
|
||||
return 1;
|
||||
|
||||
+15
-7
@@ -3433,6 +3433,13 @@ function prep_cfg(toggle) {
|
||||
let valtmp = "";
|
||||
|
||||
All['trimPath']=document.getElementById("trimPath").value;
|
||||
// Keep file output settings in the runtime state even though they are not
|
||||
// part of the projectile block. The scan runner depends on both values.
|
||||
All["fileNamePrefix"] = document.getElementById("fileNamePrefix").value;
|
||||
All["workPath"] = document.getElementById("workPath").value;
|
||||
// Thread count is a local GUI/runtime setting only. It must stay out of
|
||||
// TrimSP.cfg, but the local parallel runner still needs to read it.
|
||||
All["scanThreads"] = document.getElementById("scanThreads").value;
|
||||
|
||||
// Prepare Layers section
|
||||
let LayersSec = "[Layers]\n";
|
||||
@@ -3762,21 +3769,22 @@ async function startSequence() {
|
||||
}
|
||||
}
|
||||
|
||||
if (All["comboScan"]==1) {
|
||||
if (All["comboScan"]=="SigEScan") {
|
||||
ScanName = "SigE";
|
||||
ScanAttrib = "sigEnergy";
|
||||
} else if (All["comboScan"]==2) {
|
||||
} else if (All["comboScan"]=="AngleScan") {
|
||||
ScanName = "Angle";
|
||||
ScanAttrib = "valAngle";
|
||||
} else if (All["comboScan"]==3) {
|
||||
} else if (All["comboScan"]=="SigAngleScan") {
|
||||
ScanName = "SigAngle";
|
||||
ScanAttrib = "sigAngle";
|
||||
} else if (All["comboScan"]==4) {
|
||||
} else if (All["comboScan"]=="NProjScan") {
|
||||
ScanName = "N";
|
||||
ScanAttrib = "numberProj";
|
||||
} else if (All["comboScan"]==5) {
|
||||
ScanName = "Ld"+All["scandL"];
|
||||
ScanAttrib = "L"+All["scandL"]+"d";
|
||||
} else if (All["comboScan"]=="dScan") {
|
||||
// The GUI currently exposes the thickness scan only for layer 1.
|
||||
ScanName = "Ld1";
|
||||
ScanAttrib = "L1d";
|
||||
}
|
||||
} else {
|
||||
// For single run, array with single value of valEnergy
|
||||
|
||||
@@ -46,13 +46,13 @@ function parseStartupOptions(argv) {
|
||||
for (const candidate of candidates) {
|
||||
if (!matcher) {
|
||||
const nextPath = path.join(candidate, segment);
|
||||
if (fs.existsSync(nextPath)) {
|
||||
if (typeof nextPath === 'string' && fs.existsSync(nextPath)) {
|
||||
nextCandidates.push(nextPath);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(candidate) || !fs.statSync(candidate).isDirectory()) {
|
||||
if (typeof candidate !== 'string' || !fs.existsSync(candidate) || !fs.statSync(candidate).isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -71,12 +71,13 @@ function parseStartupOptions(argv) {
|
||||
}
|
||||
|
||||
candidates = candidates
|
||||
.filter((candidate) => fs.existsSync(candidate) && fs.statSync(candidate).isFile())
|
||||
.filter((candidate) => typeof candidate === 'string' && fs.existsSync(candidate) && fs.statSync(candidate).isFile())
|
||||
.sort();
|
||||
}
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (
|
||||
typeof candidate === 'string' &&
|
||||
path.extname(candidate).toLowerCase() === '.cfg' &&
|
||||
fs.existsSync(candidate) &&
|
||||
fs.statSync(candidate).isFile() &&
|
||||
|
||||
Reference in New Issue
Block a user