Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-09-27 16:45:45 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:44:05 +0300
commit9119ae9daa2f94279270cd3ee2133bc33ee04cda (patch)
treeade6886a6e1a37bcb03283a7336380a72cc21c3f /coding
parent5d1ece2c3ebdce2206701717176a6fe2ebda06b2 (diff)
[android]
- Fix bug with files moving. - Settings.ini should be in a one place always (default external path). - Add AlertDialog in files moving.
Diffstat (limited to 'coding')
-rw-r--r--coding/internal/file_data.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/coding/internal/file_data.cpp b/coding/internal/file_data.cpp
index ebd35e1636..10470d7f4d 100644
--- a/coding/internal/file_data.cpp
+++ b/coding/internal/file_data.cpp
@@ -237,14 +237,28 @@ bool CopyFile(string const & fOld, string const & fNew)
ifstream ifs(fOld.c_str());
ofstream ofs(fNew.c_str());
- ofs << ifs.rdbuf();
- return true;
+ if (ifs.is_open() && ofs.is_open())
+ {
+ ofs << ifs.rdbuf();
+
+ if (ofs.bad() || ofs.fail())
+ {
+ // Well, specification says that exception is thrown for critical errors.
+ // So just log stream fail state and continue.
+ LOG(LWARNING, ("Bad or Fail bit is set while writing file:", fNew));
+ }
+
+ return true;
+ }
+ else
+ LOG(LERROR, ("Can't open files:", fOld, fNew));
}
catch (exception const & ex)
{
- LOG(LERROR, ("Copy file error: ", ex.what()));
- return false;
+ LOG(LERROR, ("Copy file error:", ex.what()));
}
+
+ return false;
}
}