Guard browser OPFS machine file write helper
This commit is contained in:
@@ -4539,6 +4539,12 @@
|
||||
verifyExpectedOutput(label, await loadTextFile(opfsPath), expectedText);
|
||||
}
|
||||
|
||||
async function writeOpfsMachineFile(machineId, filename, text) {
|
||||
const opfsPath = opfsMachineFilePath(machineId, filename);
|
||||
await saveTextFile(opfsPath, text);
|
||||
return opfsPath;
|
||||
}
|
||||
|
||||
function assertOpfsSessionStaging(label, session, machineId, expectedPaths) {
|
||||
if (session.machineId !== machineId) {
|
||||
throw new Error(`${label}: unexpected machine id ${session.machineId}`);
|
||||
@@ -9389,8 +9395,9 @@
|
||||
browserIniFileTextPaths,
|
||||
"browser-ini-file-session",
|
||||
);
|
||||
await saveTextFile(
|
||||
"linuxcnc/machines/browser-ini-file-session/browser-custom.var",
|
||||
await writeOpfsMachineFile(
|
||||
"browser-ini-file-session",
|
||||
"browser-custom.var",
|
||||
[
|
||||
"5161 31.25",
|
||||
"5162 62.5",
|
||||
@@ -9400,8 +9407,9 @@
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
await saveTextFile(
|
||||
"linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl",
|
||||
await writeOpfsMachineFile(
|
||||
"browser-ini-file-session",
|
||||
"browser-custom-tool.tbl",
|
||||
"T8 P8 Z4.5 D0.5 ;browser custom tool\n",
|
||||
);
|
||||
const loadedIniFileSession = await loadMachineSessionFromOpfs(
|
||||
@@ -9560,8 +9568,9 @@
|
||||
browserIniOverrideTextPaths,
|
||||
"browser-ini-override-session",
|
||||
);
|
||||
await saveTextFile(
|
||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var",
|
||||
await writeOpfsMachineFile(
|
||||
"browser-ini-override-session",
|
||||
"browser-explicit.var",
|
||||
[
|
||||
"5161 41.25",
|
||||
"5162 82.5",
|
||||
@@ -9571,8 +9580,9 @@
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
await saveTextFile(
|
||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit-tool.tbl",
|
||||
await writeOpfsMachineFile(
|
||||
"browser-ini-override-session",
|
||||
"browser-explicit-tool.tbl",
|
||||
"T9 P9 Z5.5 D0.625 ;browser explicit tool\n",
|
||||
);
|
||||
const loadedIniOverrideSession = await loadMachineSessionFromOpfs(
|
||||
|
||||
Reference in New Issue
Block a user