mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-04 08:17:40 +00:00
Add a removeSavefile() to the default savefile manager based on the new Common::File::remove().
svn-id: r28282
This commit is contained in:
parent
f42108e633
commit
9752c75f40
@ -29,7 +29,7 @@
|
||||
#include "common/savefile.h"
|
||||
#include "common/util.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/str.h"
|
||||
#include "common/file.h"
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
#include "backends/saves/compressed/compressed-saves.h"
|
||||
|
||||
@ -180,10 +180,10 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// So stat() succeeded. But is the path actually pointing to a
|
||||
// directory?
|
||||
// So stat() succeeded. But is the path actually pointing to a directory?
|
||||
if (!S_ISDIR(sb.st_mode)) {
|
||||
setError(SFM_DIR_NOTDIR, Common::String("The given savepath is not a directory"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -215,6 +215,12 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename)
|
||||
return wrapInSaveFile(sf);
|
||||
}
|
||||
|
||||
bool DefaultSaveFileManager::removeSavefile(const char *filename) {
|
||||
Common::File file;
|
||||
FilesystemNode savePath(filename);
|
||||
return file.remove(savePath);
|
||||
}
|
||||
|
||||
Common::StringList DefaultSaveFileManager::listSavefiles(const char *regex) {
|
||||
FilesystemNode savePath(getSavePath());
|
||||
FSList savefiles;
|
||||
|
@ -34,6 +34,7 @@ class DefaultSaveFileManager : public Common::SaveFileManager {
|
||||
public:
|
||||
virtual Common::OutSaveFile *openForSaving(const char *filename);
|
||||
virtual Common::InSaveFile *openForLoading(const char *filename);
|
||||
virtual bool removeSavefile(const char *filename);
|
||||
virtual Common::StringList listSavefiles(const char *regex);
|
||||
};
|
||||
|
||||
|
@ -136,6 +136,13 @@ public:
|
||||
*/
|
||||
virtual InSaveFile *openForLoading(const char *filename) = 0;
|
||||
|
||||
/**
|
||||
* Removes the given savefile from the filesystem.
|
||||
* @param filename Filename path pointing to the savefile.
|
||||
* @return true if no error ocurred. false otherwise.
|
||||
*/
|
||||
virtual bool removeSavefile(const char *filename) = 0;
|
||||
|
||||
/**
|
||||
* Request a list of available savegames with a given regex.
|
||||
* @param regex Regular expression to match. Wildcards like * or ? are available.
|
||||
|
Loading…
Reference in New Issue
Block a user