18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 15:17:08 +01:00

fix(editor): file names outside the code page don't crash the project, includes are found in any case, a project file cut short isn't put in place

- The scenario index made a string of the name of every file in the folder, which throws on Windows for a name the ANSI code
  page can't hold (the class of GE#560). It looks at the extension first and leaves out a .scn the game couldn't open by its
  name either; the messages of the project file show paths as UTF-8.
- The includes are read with the FileCased() fallback of the game (scenery_text::file_text), so on Linux an include written in
  another case no longer drops the scenario from the index, skips the migration of its file or marks its tracks as changed by
  hand.
- save() closes the file before looking at it: a failed last flush no longer renames a truncated .new over the project.
- "next node 0" is refused instead of wrapping to 0xffffffff.
- open_project() writes no .eu07proj when there were no //$ lines to migrate, and asks exists() without throwing.
This commit is contained in:
maj00r
2026-11-24 18:54:33 +01:00
parent 2b36fbe9af
commit b15f7dcdec
8 changed files with 106 additions and 27 deletions
+4
View File
@@ -269,6 +269,10 @@ TEST_CASE("project file: a newer schema is refused cleanly, and a file which isn
REQUIRE(lower.project.has_value());
CHECK(lower.project->network.handed() == layout::network::handed_out{5, 3, 2});
CHECK_FALSE(lower.notes.empty());
// next 0: the identifiers start at 1, so it isn't taken as the last one handed out wrapped round to 0xffffffff
auto const zero{with("next node 6 line 4 vertex 3 turnout 1", "next node 0 line 4 vertex 3 turnout 1")};
CHECK_FALSE(zero.project.has_value());
CHECK(zero.error.find("the next node 0") != std::string::npos);
}
TEST_CASE("project file: the identifiers aren't handed out again after deletions and a save and a load") {