summaryrefslogtreecommitdiff
path: root/src/fs/files.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-06 23:32:44 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-06 23:32:44 +0300
commitabe7009c7347dd2821bc687d8eb692bac2609bc2 (patch)
tree89abfab81beff37fc854c2e574a12fe0bc6f92b7 /src/fs/files.cpp
parentba21ad5b52d75c98d15a547a64d246e576c1afc2 (diff)
downloadmv-abe7009c7347dd2821bc687d8eb692bac2609bc2.tar.gz
mv-abe7009c7347dd2821bc687d8eb692bac2609bc2.tar.bz2
mv-abe7009c7347dd2821bc687d8eb692bac2609bc2.tar.xz
mv-abe7009c7347dd2821bc687d8eb692bac2609bc2.zip
Show assert if failed open streamed files.
Diffstat (limited to 'src/fs/files.cpp')
-rw-r--r--src/fs/files.cpp14
1 files changed, 12 insertions, 2 deletions
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 <dirent.h>
@@ -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();
}
}