Fix debugger with GL to work with non-default locale
QApplication forces the process to use the C locale system on
"Unix/Linux" according to the docs.
The float numbers in GL shaders will be printed with printf. These will
be formatted with comma in certain locales, like LC_NUMERIC=fi_FI.UTF-8.
Force the NC_NUMERIC=C before running the QApplication.
Review URL: https://codereview.chromium.org/724753002
diff --git a/debugger/debuggermain.cpp b/debugger/debuggermain.cpp
index f749911..d537d36 100644
--- a/debugger/debuggermain.cpp
+++ b/debugger/debuggermain.cpp
@@ -17,8 +17,13 @@
}
int main(int argc, char *argv[]) {
+#ifndef SK_BUILD_FOR_WIN32
+ // Set numeric formatting to default. Otherwise shaders will have numbers with wrong comma.
+ // QApplication documentation recommends setlocale("LC_NUMERIC", "C") after QApplication
+ // constuction. However, the components Qt calls (X11 libs, ..) will override that.
+ setenv("LC_NUMERIC", "C", 1);
+#endif
QApplication a(argc, argv);
-
QStringList argList = a.arguments();
if (argList.count() <= 0) {