From d3235c9a2020b1dbeea37bdacb188e292eb32d78 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Fri, 29 Apr 2016 12:26:41 +0300 Subject: [PATCH] Merge with develop --- .../client/src/interface_v3/interface_manager.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 4d2248249..fab67d55e 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1826,7 +1826,8 @@ bool CInterfaceManager::saveConfig (const string &filename) COFile f; - if (!f.open(filename)) return false; + // using temporary file, so no f.close() unless its a success + if (!f.open(filename, false, false, true)) return false; CInterfaceConfig ic; @@ -1873,7 +1874,6 @@ bool CInterfaceManager::saveConfig (const string &filename) { nlwarning("Config saving failed"); // couldn't save result so do not continue - f.close(); return false; } @@ -1929,14 +1929,14 @@ bool CInterfaceManager::saveConfig (const string &filename) nlwarning("Bad user dyn chat saving"); return false; } + + f.close(); } catch(const NLMISC::EStream &) { - f.close(); nlwarning("Config saving failed."); return false; } - f.close(); ContinentMngr.serialFOWMaps(); @@ -2645,7 +2645,8 @@ bool CInterfaceManager::saveKeys(const std::string &filename) try { COFile file; - if (file.open (filename)) + // using temporary file, so no file.close() unless its a success + if (file.open (filename, false, false, true)) { COXml xmlStream; xmlStream.init (&file); @@ -2675,8 +2676,7 @@ bool CInterfaceManager::saveKeys(const std::string &filename) } catch (const Exception &e) { - nlwarning ("Error while writing the file %s : %s. Remove it.", filename.c_str(), e.what ()); - CFile::deleteFile(filename); + nlwarning ("Error while writing the file %s : %s.", filename.c_str(), e.what ()); } return ret; }