feat: include the compiler exe and use working relative filepath

This commit is contained in:
Guy C
2025-03-11 16:39:09 +00:00
parent bad6e47e46
commit 36ddd025b2
2 changed files with 5 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ function deactivate() {
function generateErrors(code) {
try {
console.log("generating errors")
const fs = require('fs');
const tmpFilePath = '/tmp/temp_wacc_file.wacc';
fs.writeFileSync(tmpFilePath, code);
@@ -41,8 +42,11 @@ function generateErrors(code) {
let output;
try {
// currently only works if the wacc compiler exe is in the parent directory
output = execSync(`../wacc_exe ${tmpFilePath}`, { encoding: 'utf8', stdio: 'pipe' });
const waccExePath = `${__dirname}/wacc_exe`;
output = execSync(`${waccExePath} ${tmpFilePath}`, { encoding: 'utf8', stdio: 'pipe' });
} catch (err) {
console.log("this aint working buddy")
console.log(err)
output = err.stdout;
}
let errors = [];