Handle Unicode Windows profile paths in editor settings (by Codex)

This commit is contained in:
Codex committed 2026-10-22 21:51:34 +02:00
1 parent b199f67eec
commit ef111342f9
3 files changed
+31 -3

No files matched your search

+1
View File
@@ -24,6 +24,7 @@ Validation performed:
references, dates/scales, roster moves/swaps/order, shared undo/redo/save
checkpoint, atomic OBW overwrite, exact image originals, arbitrary SVG/raster
transforms, unknown-extension preservation and authenticated MCP HTTP.
Windows additionally checks a profile directory containing non-ASCII letters.
- `tests/editor_gui_smoke.py`: real mouse/keyboard inspector edit; untouched
JSON colour field retained; native search focus; shared MCP/native undo/redo;
save to OBW. This check caught and fixed RmlUI textarea entity handling and
+10 -3
View File
@@ -3,7 +3,10 @@
#include <cstdlib>
#include <map>
#include <random>
#ifndef _WIN32
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#else
#include <sys/stat.h>
#endif
namespace bmh::editor {
@@ -11,8 +14,12 @@ Options Options::load(fs::path override_path) {
Options result;
if (override_path.empty()) {
#ifdef _WIN32
auto base = std::getenv("APPDATA");
override_path = (base ? path(base) : fs::temp_directory_path()) / "OpenBMH" / "editor.json";
// The narrow CRT environment is encoded in the active Windows code
// page, not UTF-8. Use the native path for names such as Müller.
wchar_t base[32768]{};
const auto count = GetEnvironmentVariableW(L"APPDATA", base, 32768);
override_path =
(count > 0 && count < 32768 ? fs::path(base) : fs::temp_directory_path()) / "OpenBMH" / "editor.json";
#elif defined(__APPLE__)
auto base = std::getenv("HOME");
override_path =
+20
View File
@@ -5,6 +5,10 @@
#include <httplib.h>
#include <iostream>
#include <thread>
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif
using namespace bmh::editor;
namespace {
@@ -175,6 +179,22 @@ int main() {
options.apply({{"language", "en"}, {"theme", "silver"}, {"mcp_port", 0}});
options.save();
check(Options::load(root / "settings.json").language == "en", "persistent language");
#ifdef _WIN32
{
wchar_t old_value[32768]{};
const auto length = GetEnvironmentVariableW(L"APPDATA", old_value, 32768);
struct Restore {
std::wstring value;
bool present;
~Restore() { SetEnvironmentVariableW(L"APPDATA", present ? value.c_str() : nullptr); }
} restore{old_value, length > 0};
const auto profile = root / L"Profil-ÄÖÜ";
SetEnvironmentVariableW(L"APPDATA", profile.c_str());
const auto native_options = Options::load();
check(native_options.settings_file == profile / "OpenBMH/editor.json", "Unicode Windows profile path");
check(fs::is_regular_file(native_options.settings_file), "Unicode Windows settings saved");
}
#endif
check(tr("de", "clubs") != tr("en", "clubs"), "bilingual labels");
McpServer mcp(s);
mcp.start(options);