Fix broken layer mapping if locale is different than english

This commit is contained in:
Mario Hüttel 2019-02-03 22:29:06 +01:00
parent a3be13bc7c
commit 1fa2d75abd

9
main.c
View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <locale.h>
#include "main-window.h"
#include "command-line.h"
#include "external-renderer.h"
@ -85,8 +86,6 @@ static int start_gui(int argc, char **argv)
g_application_register(G_APPLICATION(gapp), NULL, NULL);
g_signal_connect(gapp, "activate", G_CALLBACK(gapp_activate), &appdata);
menu = g_menu_new();
m_quit = g_menu_new();
m_about = g_menu_new();
@ -115,6 +114,7 @@ int main(int argc, char **argv)
GOptionContext *context;
gchar *gds_name;
gchar *basename;
struct lconv *temp_locale;
gchar *pdfname = NULL, *texname = NULL, *mappingname = NULL, *cellname = NULL, *svgname = NULL;
gboolean tikz = FALSE, pdf = FALSE, pdf_layers = FALSE, pdf_standalone = FALSE, svg = FALSE;
gchar *custom_library_path = NULL;
@ -122,6 +122,11 @@ int main(int argc, char **argv)
int scale = 1000;
int app_status;
/* Set locale for layer mapping file */
setlocale(LC_NUMERIC, "");
temp_locale = localeconv();
strcpy(temp_locale->decimal_point, ".");
strcpy(temp_locale->thousands_sep, "'");
GOptionEntry entries[] = {
{"tikz", 't', 0, G_OPTION_ARG_NONE, &tikz, "Output TikZ code", NULL },