[Scummvm-cvs-logs] SF.net SVN: scummvm:[42357] scummvm/trunk/backends/saves/default/ default-saves.cpp
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Sat Jul 11 00:29:26 CEST 2009
Revision: 42357
http://scummvm.svn.sourceforge.net/scummvm/?rev=42357&view=rev
Author: wjpalenstijn
Date: 2009-07-10 22:29:25 +0000 (Fri, 10 Jul 2009)
Log Message:
-----------
Recreate FSNode after calling checkPath since checkPath may
have created the directory the FSNode points to, invalidating
its cached metadata. In the future, it might be nice to add
a FSNode::rescan() function for this? This fixes #2793187 .
Modified Paths:
--------------
scummvm/trunk/backends/saves/default/default-saves.cpp
Modified: scummvm/trunk/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.cpp 2009-07-10 22:13:27 UTC (rev 42356)
+++ scummvm/trunk/backends/saves/default/default-saves.cpp 2009-07-10 22:29:25 UTC (rev 42357)
@@ -55,11 +55,14 @@
}
Common::StringList DefaultSaveFileManager::listSavefiles(const Common::String &pattern) {
- Common::FSNode savePath(getSavePath());
- checkPath(savePath);
+ Common::String savePathName = getSavePath();
+ checkPath(Common::FSNode(savePathName));
if (getError() != Common::kNoError)
return Common::StringList();
+ // recreate FSNode since checkPath may have changed/created the directory
+ Common::FSNode savePath(savePathName);
+
Common::FSDirectory dir(savePath);
Common::ArchiveMemberList savefiles;
Common::StringList results;
@@ -76,11 +79,14 @@
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String &filename) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
- Common::FSNode savePath(getSavePath());
- checkPath(savePath);
+ Common::String savePathName = getSavePath();
+ checkPath(Common::FSNode(savePathName));
if (getError() != Common::kNoError)
return 0;
+ // recreate FSNode since checkPath may have changed/created the directory
+ Common::FSNode savePath(savePathName);
+
Common::FSNode file = savePath.getChild(filename);
if (!file.exists())
return 0;
@@ -93,11 +99,14 @@
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) {
// Ensure that the savepath is valid. If not, generate an appropriate error.
- Common::FSNode savePath(getSavePath());
- checkPath(savePath);
+ Common::String savePathName = getSavePath();
+ checkPath(Common::FSNode(savePathName));
if (getError() != Common::kNoError)
return 0;
+ // recreate FSNode since checkPath may have changed/created the directory
+ Common::FSNode savePath(savePathName);
+
Common::FSNode file = savePath.getChild(filename);
// Open the file for saving
@@ -107,13 +116,14 @@
}
bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
- clearError();
-
- Common::FSNode savePath(getSavePath());
- checkPath(savePath);
+ Common::String savePathName = getSavePath();
+ checkPath(Common::FSNode(savePathName));
if (getError() != Common::kNoError)
return false;
+ // recreate FSNode since checkPath may have changed/created the directory
+ Common::FSNode savePath(savePathName);
+
Common::FSNode file = savePath.getChild(filename);
// FIXME: remove does not exist on all systems. If your port fails to
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