aboutsummaryrefslogtreecommitdiffstats
path: root/gowin
diff options
context:
space:
mode:
authorYRabbit <rabbit@yrabbit.cyou>2022-03-14 21:41:57 +1000
committerYRabbit <rabbit@yrabbit.cyou>2022-03-14 21:41:57 +1000
commit25d7e3ae8b409a1be550e25a2dbabc3c54f0d446 (patch)
treead646ae8cd6777f81fa4311b17502a2a894faac6 /gowin
parentc0fd0374ad0405e37cc215e980cae77b1f453692 (diff)
downloadnextpnr-25d7e3ae8b409a1be550e25a2dbabc3c54f0d446.tar.gz
nextpnr-25d7e3ae8b409a1be550e25a2dbabc3c54f0d446.tar.bz2
nextpnr-25d7e3ae8b409a1be550e25a2dbabc3c54f0d446.zip
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 <rabbit@yrabbit.cyou>
Diffstat (limited to 'gowin')
-rw-r--r--gowin/main.cc6
1 files changed, 6 insertions, 0 deletions
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 <fstream>
+#include <locale>
#include <regex>
#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();
}