101 }; |
101 }; |
102 |
102 |
103 // ============================================================================= |
103 // ============================================================================= |
104 // Load the configuration from file |
104 // Load the configuration from file |
105 bool config::load () { |
105 bool config::load () { |
|
106 // Locale must be disabled for atof |
|
107 setlocale (LC_NUMERIC, "C"); |
|
108 |
106 FILE* fp = fopen (filepath().chars(), "r"); |
109 FILE* fp = fopen (filepath().chars(), "r"); |
107 char linedata[MAX_INI_LINE]; |
110 char linedata[MAX_INI_LINE]; |
108 char* line; |
111 char* line; |
109 size_t ln = 0; |
112 size_t ln = 0; |
110 configsection_e section = NO_CONFIG_SECTION; |
113 configsection_e section = NO_CONFIG_SECTION; |
228 } |
231 } |
229 |
232 |
230 // ============================================================================= |
233 // ============================================================================= |
231 // Save the configuration to disk |
234 // Save the configuration to disk |
232 bool config::save () { |
235 bool config::save () { |
|
236 // The function will write floats, disable the locale now so that they |
|
237 // are written properly. |
|
238 setlocale (LC_NUMERIC, "C"); |
|
239 |
233 #ifdef APPNAME |
240 #ifdef APPNAME |
234 #ifdef CONFIG_WITH_QT |
241 #ifdef CONFIG_WITH_QT |
235 // If the directory doesn't exist, create it now. |
242 // If the directory doesn't exist, create it now. |
236 if (!QDir (dirpath().chars()).exists ()) { |
243 if (!QDir (dirpath().chars()).exists ()) { |
237 fprintf (stderr, "Creating config path %s...\n", dirpath().chars()); |
244 fprintf (stderr, "Creating config path %s...\n", dirpath().chars()); |