diff options
-rw-r--r-- | backends/saves/default/default-saves.cpp | 7 | ||||
-rw-r--r-- | common/file.cpp | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 54dc1c2966..06d4047a4e 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -359,7 +359,8 @@ void DefaultSaveFileManager::saveTimestamps(Common::HashMap<Common::String, uint } Common::String DefaultSaveFileManager::concatWithSavesPath(Common::String name) { - Common::String path = ConfMan.get("savepath"); + DefaultSaveFileManager *manager = dynamic_cast<DefaultSaveFileManager *>(g_system->getSavefileManager()); + Common::String path = (manager ? manager->getSavePath() : ConfMan.get("savepath")); if (path.size() > 0 && (path.lastChar() == '/' || path.lastChar() == '\\')) return path + name; @@ -369,8 +370,8 @@ Common::String DefaultSaveFileManager::concatWithSavesPath(Common::String name) if (path[i] == '/') --backslashes; else if (path[i] == '\\') ++backslashes; - if (backslashes) return path + '\\' + name; - return path + '/' + name; + if (backslashes > 0) return path + '\\' + name; + return path + '/' + name; } #endif // ifdef USE_CLOUD diff --git a/common/file.cpp b/common/file.cpp index 52b66bd2f4..5f3402e9ed 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -160,6 +160,7 @@ bool DumpFile::open(const String &filename, bool createPath) { if (filename[i] == '/' || filename[i] == '\\') { Common::String subpath = filename; subpath.erase(i); + if (subpath.empty()) continue; AbstractFSNode *node = g_system->getFilesystemFactory()->makeFileNodePath(subpath); if (node->exists()) continue; if (!node->create(true)) warning("DumpFile: unable to create directories from path prefix"); |