[Scummvm-cvs-logs] SF.net SVN: scummvm: [30061] scummvm/trunk/backends/saves/default
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Dec 28 22:12:33 CET 2007
Revision: 30061
http://scummvm.svn.sourceforge.net/scummvm/?rev=30061&view=rev
Author: fingolfin
Date: 2007-12-28 13:12:30 -0800 (Fri, 28 Dec 2007)
Log Message:
-----------
Modify DFSM::getSavePath to return a Common::String instead of a char*
Modified Paths:
--------------
scummvm/trunk/backends/saves/default/default-saves.cpp
scummvm/trunk/backends/saves/default/default-saves.h
Modified: scummvm/trunk/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.cpp 2007-12-28 16:47:28 UTC (rev 30060)
+++ scummvm/trunk/backends/saves/default/default-saves.cpp 2007-12-28 21:12:30 UTC (rev 30061)
@@ -202,11 +202,11 @@
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
char buf[256];
- const char *savePath = getSavePath();
+ Common::String savePath = getSavePath();
checkPath(savePath);
if (getError() == SFM_NO_ERROR) {
- join_paths(filename, savePath, buf, sizeof(buf));
+ join_paths(filename, savePath.c_str(), buf, sizeof(buf));
StdioSaveFile *sf = new StdioSaveFile(buf, false);
if (!sf->isOpen()) {
@@ -223,11 +223,11 @@
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
char buf[256];
- const char *savePath = getSavePath();
+ Common::String savePath = getSavePath();
checkPath(savePath);
if (getError() == SFM_NO_ERROR) {
- join_paths(filename, savePath, buf, sizeof(buf));
+ join_paths(filename, savePath.c_str(), buf, sizeof(buf));
StdioSaveFile *sf = new StdioSaveFile(buf, true);
if (!sf->isOpen()) {
@@ -245,7 +245,7 @@
char buf[256];
clearError();
Common::String filenameStr;
- join_paths(filename, getSavePath(), buf, sizeof(buf));
+ join_paths(filename, getSavePath().c_str(), buf, sizeof(buf));
if (remove(buf) != 0) {
#ifndef _WIN32_WCE
@@ -261,28 +261,26 @@
}
}
-const char *DefaultSaveFileManager::getSavePath() const {
+Common::String DefaultSaveFileManager::getSavePath() const {
- const char *dir = NULL;
+ Common::String dir;
// Try to use game specific savepath from config
- dir = ConfMan.get("savepath").c_str();
+ dir = ConfMan.get("savepath");
// Work around a bug (#999122) in the original 0.6.1 release of
// ScummVM, which would insert a bad savepath value into config files.
- if (0 == strcmp(dir, "None")) {
+ if (dir == "None") {
ConfMan.removeKey("savepath", ConfMan.getActiveDomainName());
ConfMan.flushToDisk();
- dir = ConfMan.get("savepath").c_str();
+ dir = ConfMan.get("savepath");
}
#ifdef _WIN32_WCE
- if (dir[0] == 0)
- dir = ConfMan.get("path").c_str();
+ if (dir.empty())
+ dir = ConfMan.get("path");
#endif
- assert(dir);
-
return dir;
}
Modified: scummvm/trunk/backends/saves/default/default-saves.h
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.h 2007-12-28 16:47:28 UTC (rev 30060)
+++ scummvm/trunk/backends/saves/default/default-saves.h 2007-12-28 21:12:30 UTC (rev 30061)
@@ -45,7 +45,7 @@
* Should only be used internally since some platforms
* might implement savefiles in a completely different way.
*/
- virtual const char *getSavePath() const;
+ virtual Common::String getSavePath() const;
/**
* Checks the given path for read access, existence, etc.
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