From 25d7e3ae8b409a1be550e25a2dbabc3c54f0d446 Mon Sep 17 00:00:00 2001 From: YRabbit Date: Mon, 14 Mar 2022 21:41:57 +1000 Subject: [PATCH] gowin: support for locales other than en_US and C Specifically, those locales where the fractional part separator in floating point numbers is not a dot. Signed-off-by: YRabbit --- gowin/main.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gowin/main.cc b/gowin/main.cc index 1473f3e8..db74545e 100644 --- a/gowin/main.cc +++ b/gowin/main.cc @@ -21,6 +21,7 @@ #ifdef MAIN_EXECUTABLE #include +#include #include #include "command.h" #include "design_utils.h" @@ -90,6 +91,11 @@ void GowinCommandHandler::customAfterLoad(Context *ctx) int main(int argc, char *argv[]) { + // set the locale here because when you create a context you create several + // floating point strings whose representation depends on the locale. If + // you don't do this, the strings will be in the C locale and later when Qt + // starts it won't be able to read them back as numbers. + std::locale::global(std::locale("")); GowinCommandHandler handler(argc, argv); return handler.exec(); }