aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2011-03-25 15:02:33 +0100
committerMax Horn2011-03-25 15:02:33 +0100
commit0c09dafdbbcccfae5838ac1f59589cb315095a0a (patch)
tree77d9f09e4d5df3c6f2753e77a94c47727652ec07 /backends
parentbb6a5c3685ef555ab63ee1fd39173dbdad9a2a13 (diff)
parent5a1874e3d946002c21af9ed315f762bfb467ef3f (diff)
downloadscummvm-rg350-0c09dafdbbcccfae5838ac1f59589cb315095a0a.tar.gz
scummvm-rg350-0c09dafdbbcccfae5838ac1f59589cb315095a0a.tar.bz2
scummvm-rg350-0c09dafdbbcccfae5838ac1f59589cb315095a0a.zip
Merge branch 'copysavefile' of https://github.com/Littleboy/scummvm into Littleboy-copysavefile
Diffstat (limited to 'backends')
-rw-r--r--backends/saves/savefile.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp
index d2fc913f14..7b7d6b0c0c 100644
--- a/backends/saves/savefile.cpp
+++ b/backends/saves/savefile.cpp
@@ -31,8 +31,7 @@
namespace Common {
-bool SaveFileManager::renameSavefile(const String &oldFilename, const String &newFilename) {
-
+bool SaveFileManager::copySavefile(const String &oldFilename, const String &newFilename) {
InSaveFile *inFile = 0;
OutSaveFile *outFile = 0;
uint32 size = 0;
@@ -57,9 +56,8 @@ bool SaveFileManager::renameSavefile(const String &oldFilename, const String &ne
if (!error) {
outFile->write(buffer, size);
outFile->finalize();
- if (!outFile->err()) {
- success = removeSavefile(oldFilename);
- }
+
+ success = !outFile->err();
}
}
@@ -71,6 +69,13 @@ bool SaveFileManager::renameSavefile(const String &oldFilename, const String &ne
return success;
}
+bool SaveFileManager::renameSavefile(const String &oldFilename, const String &newFilename) {
+ if (!copySavefile(oldFilename, newFilename))
+ return false;
+
+ return removeSavefile(oldFilename);
+}
+
String SaveFileManager::popErrorDesc() {
String err = _errorDesc;
clearError();