Guard browser OPFS default filename constants
This commit is contained in:
@@ -4478,11 +4478,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
const OPFS_DEFAULT_INI_FILENAME = "machine.ini";
|
||||
const OPFS_DEFAULT_PARAMETER_FILENAME = "linuxcnc.var";
|
||||
const OPFS_DEFAULT_TOOL_TABLE_FILENAME = "tool.tbl";
|
||||
|
||||
function assertMachineTextStorePaths(label, paths, machineId) {
|
||||
const expectedPaths = {
|
||||
ini: opfsMachineFilePath(machineId, "machine.ini"),
|
||||
toolTable: opfsMachineFilePath(machineId, "tool.tbl"),
|
||||
parameters: opfsMachineFilePath(machineId, "linuxcnc.var"),
|
||||
ini: opfsMachineFilePath(machineId, OPFS_DEFAULT_INI_FILENAME),
|
||||
toolTable: opfsMachineFilePath(machineId, OPFS_DEFAULT_TOOL_TABLE_FILENAME),
|
||||
parameters: opfsMachineFilePath(machineId, OPFS_DEFAULT_PARAMETER_FILENAME),
|
||||
};
|
||||
for (const [name, expectedPath] of Object.entries(expectedPaths)) {
|
||||
if (paths[name] !== expectedPath) {
|
||||
@@ -4591,9 +4595,9 @@
|
||||
throw new Error(`${label}: unexpected machine id ${session.machineId}`);
|
||||
}
|
||||
const expectedOpfsPaths = {
|
||||
ini: opfsMachineFilePath(machineId, "machine.ini"),
|
||||
parameters: opfsMachineFilePath(machineId, "linuxcnc.var"),
|
||||
toolTable: opfsMachineFilePath(machineId, "tool.tbl"),
|
||||
ini: opfsMachineFilePath(machineId, OPFS_DEFAULT_INI_FILENAME),
|
||||
parameters: opfsMachineFilePath(machineId, OPFS_DEFAULT_PARAMETER_FILENAME),
|
||||
toolTable: opfsMachineFilePath(machineId, OPFS_DEFAULT_TOOL_TABLE_FILENAME),
|
||||
...(expectedPaths.opfs ?? {}),
|
||||
};
|
||||
assertOpfsIniStaging(
|
||||
@@ -4626,7 +4630,7 @@
|
||||
iniSdk,
|
||||
iniWasmPath: `/work/${machineId}.ini`,
|
||||
};
|
||||
const expectedIniOpfsPath = opfsMachineFilePath(machineId, "machine.ini");
|
||||
const expectedIniOpfsPath = opfsMachineFilePath(machineId, OPFS_DEFAULT_INI_FILENAME);
|
||||
assertOpfsIniStaging(
|
||||
`${label}_ini_staging`,
|
||||
{
|
||||
@@ -9254,7 +9258,7 @@
|
||||
"opfs_save_parameters_staging",
|
||||
savedParameters,
|
||||
browserInterpMachineId,
|
||||
"linuxcnc.var",
|
||||
OPFS_DEFAULT_PARAMETER_FILENAME,
|
||||
browserInterpParameterWasmPath,
|
||||
);
|
||||
verifyOpfsSaveResult(
|
||||
@@ -9300,7 +9304,7 @@
|
||||
"opfs_save_tool_table_staging",
|
||||
savedToolTable,
|
||||
browserInterpMachineId,
|
||||
"tool.tbl",
|
||||
OPFS_DEFAULT_TOOL_TABLE_FILENAME,
|
||||
browserInterpToolTableWasmPath,
|
||||
);
|
||||
verifyOpfsSaveResult(
|
||||
@@ -9410,7 +9414,7 @@
|
||||
"opfs_save_random_tool_table_staging",
|
||||
savedRandomToolTable,
|
||||
browserRandomMachineId,
|
||||
"tool.tbl",
|
||||
OPFS_DEFAULT_TOOL_TABLE_FILENAME,
|
||||
browserRandomToolTableWasmPath,
|
||||
);
|
||||
verifyOpfsSaveResult(
|
||||
|
||||
Reference in New Issue
Block a user