From fa116bf277d6fbcf4697cf4d3dd7076af86574f1 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 10 Dec 2024 15:46:21 -0500 Subject: [PATCH] allow .debug module to load for shared electron/debug modules. filter defines from macros. add bambu check before attempted file send --- app.js | 3 ++- bin/electron-pre.js | 1 + package.json | 1 + src/kiri-mode/fdm/export.js | 4 +++- src/kiri/export.js | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index a75f489a..01948ecf 100644 --- a/app.js +++ b/app.js @@ -335,9 +335,10 @@ function init(mod) { if (dir.charAt(0) === '.') return; const stats = fs.lstatSync(`${mod.dir}/${modpath}`); if (!(stats.isDirectory() || stats.isSymbolicLink())) return; + const isDebugMod = util.isfile(PATH.join(mod.dir,modpath,".debug")); const isElectronMod = util.isfile(PATH.join(mod.dir,modpath,".electron")); if (ENV.electron && !isElectronMod) return; - if (!ENV.electron && isElectronMod) return; + if (!ENV.electron && isElectronMod && !isDebugMod) return; try { loadModule(mod, modpath); } catch (error) { diff --git a/bin/electron-pre.js b/bin/electron-pre.js index b7369b44..b5554a9f 100644 --- a/bin/electron-pre.js +++ b/bin/electron-pre.js @@ -13,6 +13,7 @@ const modTmp = path.join('tmp','mod'); fs.copySync("mod", modTmp, { dereference: true, filter:(src,dst) => { const ok = src === 'mod' || + src.indexOf('mod/ext-bambu') === 0 || src.indexOf('mod/standalone') === 0 || src.indexOf('mod/node_modules') === 0; // console.log(ok, src); diff --git a/package.json b/package.json index 3b10de4e..538a1dbf 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ }, "scripts": { "dev": "gs-app-server --debug", + "prod": "gs-app-server", "start": "npm run prebuild && electron .", "start-dev": "npm run prebuild && electron . --devel", "start-dbg": "npm run prebuild && electron . --debugg", diff --git a/src/kiri-mode/fdm/export.js b/src/kiri-mode/fdm/export.js index a53aba40..42b3b738 100644 --- a/src/kiri-mode/fdm/export.js +++ b/src/kiri-mode/fdm/export.js @@ -230,7 +230,9 @@ FDM.export = function(print, online, ondone, ondebug) { // with logic flow IF / ELIF / ELSE / END // IF / IF is valid but will not nest function appendSub(line, pad) { - if (line.indexOf(';; IF ') === 0) { + if (line.indexOf(';; DEFINE ') === 0) { + // ignore var declarations + } else if (line.indexOf(';; IF ') === 0) { line = line.substring(6).trim(); let evil = print.constReplace(line, subst, 0, 666); subon = evil; diff --git a/src/kiri/export.js b/src/kiri/export.js index 3c31a7af..e8d6b2e1 100644 --- a/src/kiri/export.js +++ b/src/kiri/export.js @@ -635,7 +635,7 @@ function exportGCodeDialog(gcode, sections, info, names) { api.show.progress(progress.percent/100, "generating 3mf"); }, output => { api.show.progress(0); - if (api.bambu) { + if (api.bambu && api.bambu.sendok({ gcode, info, settings })) { api.bambu.send(`${$('print-filename').value}.3mf`, output); } else { api.util.download(output, `${$('print-filename').value}.3mf`);