From 99d75220e76b9bdd786fc625016980b94482fac0 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Mon, 24 Aug 2015 13:30:01 +0200 Subject: [PATCH] cfg/cfg: Don't save the config immediately after opening. --- core/cfg/cfg.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/core/cfg/cfg.cpp b/core/cfg/cfg.cpp index e308d4b4f..6b7102ce9 100644 --- a/core/cfg/cfg.cpp +++ b/core/cfg/cfg.cpp @@ -73,27 +73,15 @@ bool cfgOpen() { cfgPath=GetPath("/emu.cfg"); FILE* cfgfile = fopen(cfgPath.c_str(),"r"); + 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()); - else - { - 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()); - } + return false; } cfgdb.parse(cfgfile); + fclose(cfgfile); - if (cfgfile) - { - cfgdb.save(cfgfile); - fclose(cfgfile); - } return true; }