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>
This commit is contained in:
YRabbit 2022-03-14 21:41:57 +10:00
parent c0fd0374ad
commit 25d7e3ae8b

View File

@ -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();
}