Keep listing saved parks when the parks folder holds an oddly named file

This commit is contained in:
xThrasherrr committed 2026-10-06 13:21:42 -06:00
1 parent c646906b0b
commit 7a37f6efc5
2 files changed
+5 -1

No files matched your search

@@ -275,8 +275,11 @@ int main(int argc, char **argv) {
bad.objects[0].rotation = {};
rejects([&] { save_park(directory, name, bad); });
check(load_park(directory, name).objects == park.objects, "Rejected save overwrote previous park");
const auto stray = directory / L"\U0001F6F9 notes.txt"; // No ANSI code page can hold this name.
std::ofstream(stray).put('x');
const auto names = list_parks(directory);
check(std::find(names.begin(), names.end(), name) != names.end(), "Saved park missing from browser");
std::filesystem::remove(stray);
std::filesystem::remove(directory / (name + ".park.json"));
// Park mods: <data>/Mods/<folder>/manifest.json + parks/<map>.park.json.
{
@@ -1,4 +1,5 @@
#include "park_document.h"
#include "Engine/Vfs/mod_list.h"
#include <Windows.h>
#include <algorithm>
#include <fstream>
@@ -80,7 +81,7 @@ std::vector<std::string> list_parks(const std::filesystem::path &directory) {
!error && it != end && names.size() < 256; it.increment(error)) {
if (!it->is_regular_file(error))
continue;
auto name = it->path().filename().string();
auto name = mods::ascii_path(it->path().filename());
if (!name.ends_with(".park.json"))
continue;
name.resize(name.size() - 10);