mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 04:28:37 +00:00
Merge branch 'copysavefile' of https://github.com/Littleboy/scummvm into Littleboy-copysavefile
This commit is contained in:
commit
0c09dafdbb
@ -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();
|
||||
|
@ -135,6 +135,14 @@ public:
|
||||
*/
|
||||
virtual bool renameSavefile(const String &oldName, const String &newName);
|
||||
|
||||
/**
|
||||
* Copy the given savefile.
|
||||
* @param oldName Old name.
|
||||
* @param newName New name.
|
||||
* @return true if no error occurred. false otherwise.
|
||||
*/
|
||||
virtual bool copySavefile(const String &oldName, const String &newName);
|
||||
|
||||
/**
|
||||
* Request a list of available savegames with a given DOS-style pattern,
|
||||
* also known as "glob" in the UNIX world. Refer to the Common::matchString()
|
||||
|
Loading…
Reference in New Issue
Block a user