[Scummvm-cvs-logs] SF.net SVN: scummvm: [28282] scummvm/branches/gsoc2007-fsnode

david_corrales at users.sourceforge.net david_corrales at users.sourceforge.net
Sun Jul 29 03:36:59 CEST 2007


Revision: 28282
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28282&view=rev
Author:   david_corrales
Date:     2007-07-28 18:36:59 -0700 (Sat, 28 Jul 2007)

Log Message:
-----------
Add a removeSavefile() to the default savefile manager based on the new Common::File::remove().

Modified Paths:
--------------
    scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.cpp
    scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.h
    scummvm/branches/gsoc2007-fsnode/common/savefile.h

Modified: scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.cpp	2007-07-28 22:18:43 UTC (rev 28281)
+++ scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.cpp	2007-07-29 01:36:59 UTC (rev 28282)
@@ -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 @@
 			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 @@
 	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;

Modified: scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.h	2007-07-28 22:18:43 UTC (rev 28281)
+++ scummvm/branches/gsoc2007-fsnode/backends/saves/default/default-saves.h	2007-07-29 01:36:59 UTC (rev 28282)
@@ -34,6 +34,7 @@
 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);
 };
 

Modified: scummvm/branches/gsoc2007-fsnode/common/savefile.h
===================================================================
--- scummvm/branches/gsoc2007-fsnode/common/savefile.h	2007-07-28 22:18:43 UTC (rev 28281)
+++ scummvm/branches/gsoc2007-fsnode/common/savefile.h	2007-07-29 01:36:59 UTC (rev 28282)
@@ -137,6 +137,13 @@
 	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.
 	 * returns a list of strings for all present file names.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list