diff options
author | David Corrales | 2007-07-29 01:36:59 +0000 |
---|---|---|
committer | David Corrales | 2007-07-29 01:36:59 +0000 |
commit | 9752c75f407c8bd82006222433fcc3618b9e82bb (patch) | |
tree | c33cd0535db9cf4c9c358e222b640c5e8b7cd421 /backends/saves | |
parent | f42108e63399f4329bb1cadfd2e21d808aea8a89 (diff) | |
download | scummvm-rg350-9752c75f407c8bd82006222433fcc3618b9e82bb.tar.gz scummvm-rg350-9752c75f407c8bd82006222433fcc3618b9e82bb.tar.bz2 scummvm-rg350-9752c75f407c8bd82006222433fcc3618b9e82bb.zip |
Add a removeSavefile() to the default savefile manager based on the new Common::File::remove().
svn-id: r28282
Diffstat (limited to 'backends/saves')
-rw-r--r-- | backends/saves/default/default-saves.cpp | 12 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index f41455be3f..299c528e46 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -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; diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index 4b525cabc8..2baddd1335 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -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); }; |