按源清理OPFS参数scratch

结论:依据 LinuxCNC rs274ngc_pre.cc restore_parameters() 只读取配置参数文件、interp_internal.hh 默认 rs274ngc.var/.bak 常量,浏览器 OPFS loadParameterFile 在加载存在的参数文件前清理 rs274ngc.var.new/.bak scratch,避免旧 WASM mirror 污染;缺失文件路径继续清空 scratch 并返回 null。

检查:./test-native.sh 通过;./test-linuxcnc-source-link.sh 通过。
This commit is contained in:
cnc
2026-06-06 11:47:33 +08:00
parent 92562db29f
commit 4e246738ac
2 changed files with 22 additions and 27 deletions

View File

@@ -499,6 +499,7 @@ function installOpfsWorkspace(module, options) {
assertRelativePath(path);
try {
const data = await readOpfsFile(workspacePath, path);
cleanupLinuxCncParameterFiles(module);
writeWasmFileReplacingPath(module, LINUXCNC_DEFAULT_PARAMETER_FILE, data);
writeWasmFileReplacingPath(module, `/${LINUXCNC_DEFAULT_PARAMETER_FILE}`, data);
return data;