cfg/cfg: Don't save the config immediately after opening.
This commit is contained in:
parent
719850a349
commit
99d75220e7
|
@ -73,27 +73,15 @@ bool cfgOpen()
|
||||||
{
|
{
|
||||||
cfgPath=GetPath("/emu.cfg");
|
cfgPath=GetPath("/emu.cfg");
|
||||||
FILE* cfgfile = fopen(cfgPath.c_str(),"r");
|
FILE* cfgfile = fopen(cfgPath.c_str(),"r");
|
||||||
|
|
||||||
if(!cfgfile) {
|
if(!cfgfile) {
|
||||||
cfgfile = fopen(cfgPath.c_str(),"wt");
|
|
||||||
if(!cfgfile)
|
|
||||||
printf("Unable to open the config file for reading or writing\nfile : %s\n",cfgPath.c_str());
|
printf("Unable to open the config file for reading or writing\nfile : %s\n",cfgPath.c_str());
|
||||||
else
|
return false;
|
||||||
{
|
|
||||||
fseek(cfgfile,0,SEEK_SET);
|
|
||||||
fclose(cfgfile);
|
|
||||||
cfgfile = fopen(cfgPath.c_str(),"r");
|
|
||||||
if(!cfgfile)
|
|
||||||
printf("Unable to open the config file for reading\nfile : %s\n",cfgPath.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cfgdb.parse(cfgfile);
|
cfgdb.parse(cfgfile);
|
||||||
|
fclose(cfgfile);
|
||||||
|
|
||||||
if (cfgfile)
|
|
||||||
{
|
|
||||||
cfgdb.save(cfgfile);
|
|
||||||
fclose(cfgfile);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue