State share Unicode fix (#834)

This commit is contained in:
Pieter-Jan Briers
2026-05-10 18:35:11 +02:00
committed by GitHub
parent 4ec8c1aaee
commit a86fa9c162
+5 -6
View File
@@ -48,19 +48,18 @@ void ImGuiStateShare::onMergeFileSelected(void* userdata, const char* path, cons
static std::string GetStatesFilePath() {
return (dusk::ConfigPath / STATES_FILENAME).string();
static std::filesystem::path GetStatesFilePath() {
return ConfigPath / STATES_FILENAME;
}
void ImGuiStateShare::loadStatesFile() {
m_loaded = true;
const std::filesystem::path filePath = dusk::ConfigPath / STATES_FILENAME;
const std::filesystem::path filePath = GetStatesFilePath();
if (!std::filesystem::exists(filePath)) {
return;
}
try {
const std::string pathStr = filePath.string();
auto data = io::FileStream::ReadAllBytes(pathStr.c_str());
auto data = io::FileStream::ReadAllBytes(filePath);
auto j = json::parse(data);
if (!j.is_array()) {
return;
@@ -85,7 +84,7 @@ void ImGuiStateShare::saveStatesFile() {
j.push_back(json{{"name", s.name}, {"data", s.encoded}});
}
try {
io::FileStream::WriteAllText(GetStatesFilePath().c_str(), j.dump(2));
io::FileStream::WriteAllText(GetStatesFilePath(), j.dump(2));
} catch (const std::exception& e) {
m_statusMsg = fmt::format("Failed to save states: {}", e.what());
}