mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 22:07:05 +02:00
Keep listing saved parks when the parks folder holds an oddly named file
This commit is contained in:
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);
|
||||
|
||||
Reference in new issue
Block a user