推进 INI 面板 G-code 回退来源 guard

This commit is contained in:
2026-06-14 15:39:18 +08:00
parent f204b7f113
commit a158f66071
3 changed files with 85 additions and 1 deletions

View File

@@ -323,9 +323,11 @@ function gcodeFilenameFromSnapshotPath(path) {
async function loadSelectedGcodeProgram() {
const opfsPath = restoredSessionSnapshot?.payload?.files?.gcode;
const filename = gcodeFilenameFromSnapshotPath(opfsPath);
const hasSnapshotGcode = typeof opfsPath === "string" && opfsPath.startsWith("linuxcnc/gcode/");
return {
filename,
opfsPath: opfsPath ?? `linuxcnc/gcode/${filename}`,
source: hasSnapshotGcode ? "snapshot" : "default",
wasmPath: GCODE_WASM_FILE,
text: await loadGcodeProgram(filename),
};
@@ -593,6 +595,7 @@ document.getElementById("run-gcode").addEventListener("click", async () => {
[
"Ran G-code through LinuxCNC interpreter WASM.",
`Program: ${program.opfsPath} -> ${program.wasmPath}`,
`Program source: ${program.source}`,
`INI: ${loadedSession.ini.wasmPath}`,
result.trim(),
].join("\n"),