From b85a41b42a2f95555ceaa985789ec7608085790c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 15 Oct 2014 21:31:43 +0200 Subject: Also fixed the same thing in file writing code --- src/common/profile.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/common') diff --git a/src/common/profile.cpp b/src/common/profile.cpp index c43cd75..92fc1d6 100644 --- a/src/common/profile.cpp +++ b/src/common/profile.cpp @@ -59,7 +59,7 @@ bool CProfile::Init() try { std::unique_ptr stream; - bool good = false; + bool good; if (m_useCurrentDirectory) { std::ifstream* inputStream = new std::ifstream("./colobot.ini"); @@ -98,16 +98,21 @@ bool CProfile::Save() try { std::unique_ptr stream; + bool good; if (m_useCurrentDirectory) { - stream = std::unique_ptr(new std::ofstream("./colobot.ini")); + std::ofstream* outputStream = new std::ofstream("./colobot.ini"); + stream = std::unique_ptr(outputStream); + good = outputStream->good(); } else { - stream = std::unique_ptr(new COutputStream("colobot.ini")); + COutputStream* outputStream = new COutputStream("colobot.ini"); + stream = std::unique_ptr(outputStream); + good = outputStream->is_open(); } - if (stream->good()) + if (good) { bp::ini_parser::write_ini(*stream, m_propertyTree); } -- cgit v1.2.3-1-g7c22