aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2007-12-28 21:12:30 +0000
committerMax Horn2007-12-28 21:12:30 +0000
commit55b6ee3982ddc07797b26df7527bd438255566a5 (patch)
tree778408e2e8034cc47ed7415c2d0b015b4bf2631f
parenta31bd32bc59e7ffab62143ec44801b6256483c88 (diff)
downloadscummvm-rg350-55b6ee3982ddc07797b26df7527bd438255566a5.tar.gz
scummvm-rg350-55b6ee3982ddc07797b26df7527bd438255566a5.tar.bz2
scummvm-rg350-55b6ee3982ddc07797b26df7527bd438255566a5.zip
Modify DFSM::getSavePath to return a Common::String instead of a char*
svn-id: r30061
-rw-r--r--backends/saves/default/default-saves.cpp26
-rw-r--r--backends/saves/default/default-saves.h2
2 files changed, 13 insertions, 15 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index bb65cfd29b..aaa403291f 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -202,11 +202,11 @@ void DefaultSaveFileManager::checkPath(const Common::String &path) {
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::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename)
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 @@ bool DefaultSaveFileManager::removeSavefile(const char *filename) {
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 @@ bool DefaultSaveFileManager::removeSavefile(const char *filename) {
}
}
-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;
}
diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h
index 6cf842b00c..5d7bf159ff 100644
--- a/backends/saves/default/default-saves.h
+++ b/backends/saves/default/default-saves.h
@@ -45,7 +45,7 @@ protected:
* 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.