mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Changed: Check if LC_NUMERIC is correct before loading or saving config files
This commit is contained in:
parent
b342f11949
commit
03715a64e0
1 changed files with 13 additions and 2 deletions
|
@ -316,6 +316,13 @@ CConfigFile::~CConfigFile ()
|
||||||
|
|
||||||
void CConfigFile::load (const string &fileName, bool lookupPaths )
|
void CConfigFile::load (const string &fileName, bool lookupPaths )
|
||||||
{
|
{
|
||||||
|
char *locale = setlocale(LC_NUMERIC, NULL);
|
||||||
|
|
||||||
|
if (!locale || strcmp(locale, "C"))
|
||||||
|
{
|
||||||
|
nlerror("Numeric locale not defined to C, an external library possibly redefined it!");
|
||||||
|
}
|
||||||
|
|
||||||
if(fileName.empty())
|
if(fileName.empty())
|
||||||
{
|
{
|
||||||
nlwarning ("CF: Can't load a empty file name configfile");
|
nlwarning ("CF: Can't load a empty file name configfile");
|
||||||
|
@ -597,8 +604,12 @@ bool CConfigFile::exists (const std::string &varName)
|
||||||
|
|
||||||
void CConfigFile::save () const
|
void CConfigFile::save () const
|
||||||
{
|
{
|
||||||
// Avoid any problem, Force Locale to default
|
char *locale = setlocale(LC_NUMERIC, NULL);
|
||||||
setlocale(LC_ALL, "C");
|
|
||||||
|
if (!locale || strcmp(locale, "C"))
|
||||||
|
{
|
||||||
|
nlerror("Numeric locale not defined to C, an external library possibly redefined it!");
|
||||||
|
}
|
||||||
|
|
||||||
FILE *fp = nlfopen (getFilename(), "w");
|
FILE *fp = nlfopen (getFilename(), "w");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
|
Loading…
Reference in a new issue