From abe7009c7347dd2821bc687d8eb692bac2609bc2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Mar 2017 23:32:44 +0300 Subject: Show assert if failed open streamed files. --- src/fs/files.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/fs/files.cpp') diff --git a/src/fs/files.cpp b/src/fs/files.cpp index aeb0dd6a4..d8a6e76ec 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -30,6 +30,7 @@ #include "fs/virtlist.h" #endif // defined(ANDROID) || defined(__native_client__) +#include "utils/checkutils.h" #include "utils/stringutils.h" #include @@ -223,7 +224,8 @@ bool Files::loadTextFileLocal(const std::string &fileName, if (!file.is_open()) { - logger->log("Couldn't load text file: %s", fileName.c_str()); + reportAlways("Couldn't load text file: %s", + fileName.c_str()); return false; } @@ -240,9 +242,17 @@ void Files::saveTextFile(std::string path, if (!mkdir_r(path.c_str())) { std::ofstream file; - file.open((path.append("/").append(name)).c_str(), std::ios::out); + std::string fileName = path.append("/").append(name); + file.open(fileName.c_str(), std::ios::out); if (file.is_open()) + { file << text << std::endl; + } + else + { + reportAlways("Error opening file for writing: %s", + fileName.c_str()); + } file.close(); } } -- cgit v1.2.3-60-g2f50