From bc35a552167de53b142ac6b13330f09a7082450c Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 21 Apr 2024 00:45:43 +0100 Subject: [PATCH] Improves initialization of platform --- dist/index.js | 19 +++++++++++++++++-- index.js | 22 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6168224..cdd7e4f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -23258,8 +23258,23 @@ : input.includePath; if (input.initPlatform) { - const command = `"${mteExe}" /log:CON /portable ${ - mte64Exe.length > 0 + const configFilePath = `tester.ini`; + const mt64Exe = + glob.sync(Path.join(input.platformPath, '**', 'terminal64.exe'), { + nocase: true + })[0] || ''; + const mt32Exe = + glob.sync(Path.join(input.platformPath, '**', 'terminal.exe'), { + nocase: true + })[0] || ''; + const mtExe = mt64Exe || mt32Exe || ''; + if (mtExe.length > 0) { + input.verbose && console.log(`MT path: "${mtExe}".`); + } else { + throw new Error(`Terminal cannot be found in "${input.platformPath}"!`); + } + const command = `"${mtExe}" /log:CON /portable ${ + mt64Exe.length > 0 ? `"/config:${configFilePath}"` : `"${configFilePath}"` }`; diff --git a/index.js b/index.js index 36de50a..3bfdac0 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,6 @@ if (!isPost) { try { process.chdir(input.workingDirectory); - const configFilePath = `tester.ini`; const mte64Exe = glob.sync(Path.join(input.platformPath, '**', 'metaeditor64.exe'), { nocase: true @@ -77,7 +76,7 @@ if (!isPost) { if (mteExe.length > 0) { input.verbose && console.log(`MTE path: "${mteExe}".`); } else { - throw new Error(`Platform cannot be found in "${input.platformPath}"!`); + throw new Error(`Compiler cannot be found in "${input.platformPath}"!`); } const includePath = @@ -86,8 +85,23 @@ if (!isPost) { : input.includePath; if (input.initPlatform) { - const command = `"${mteExe}" /log:CON /portable ${ - mte64Exe.length > 0 + const configFilePath = `tester.ini`; + const mt64Exe = + glob.sync(Path.join(input.platformPath, '**', 'terminal64.exe'), { + nocase: true + })[0] || ''; + const mt32Exe = + glob.sync(Path.join(input.platformPath, '**', 'terminal.exe'), { + nocase: true + })[0] || ''; + const mtExe = mt64Exe || mt32Exe || ''; + if (mtExe.length > 0) { + input.verbose && console.log(`MT path: "${mtExe}".`); + } else { + throw new Error(`Terminal cannot be found in "${input.platformPath}"!`); + } + const command = `"${mtExe}" /log:CON /portable ${ + mt64Exe.length > 0 ? `"/config:${configFilePath}"` : `"${configFilePath}"` }`;