按源保护 OPFS 参数备份失败边界
This commit is contained in:
@@ -529,7 +529,12 @@ function installOpfsWorkspace(module, options) {
|
||||
const backupPath = `${LINUXCNC_DEFAULT_PARAMETER_FILE}.bak`;
|
||||
const backupData = readFirstExistingWasmFile(module, [backupPath, `/${backupPath}`]);
|
||||
if (backupData !== null) {
|
||||
await writeOpfsFile(workspacePath, `${path}.bak`, backupData);
|
||||
try {
|
||||
await writeOpfsFile(workspacePath, `${path}.bak`, backupData);
|
||||
} catch (_backupError) {
|
||||
// LinuxCNC reports link(filename, filename + ".bak") failures
|
||||
// with perror() and still renames filename + ".new" over filename.
|
||||
}
|
||||
} else {
|
||||
await removeOpfsFileEntry(workspacePath, `${path}.bak`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user