aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-09-30 16:38:46 +0000
committerMax Horn2008-09-30 16:38:46 +0000
commite5dbb3f901789f820a8fa67c52514434ed27920c (patch)
tree8714553a958a178efcbbdbad34a068d552166887
parent73b833042e55959954d78b3e6aa2cc89c5b8848d (diff)
downloadscummvm-rg350-e5dbb3f901789f820a8fa67c52514434ed27920c.tar.gz
scummvm-rg350-e5dbb3f901789f820a8fa67c52514434ed27920c.tar.bz2
scummvm-rg350-e5dbb3f901789f820a8fa67c52514434ed27920c.zip
AGI: Got rid of yet another unwarranted use of FSNode::getPath
svn-id: r34710
-rw-r--r--engines/agi/detection.cpp6
-rw-r--r--engines/agi/wagparser.cpp14
-rw-r--r--engines/agi/wagparser.h2
3 files changed, 11 insertions, 11 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 2b2d7e080b..f05621e875 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -2207,7 +2207,7 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL
bool matchedUsingWag = false;
int wagFileCount = 0;
WagFileParser wagFileParser;
- Common::String wagFilePath;
+ Common::FilesystemNode wagFileNode;
Common::String description;
Common::FSList fslistCurrentDir; // Only used if fslist == NULL
@@ -2246,7 +2246,7 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL
if (filename.hasSuffix(".wag")) {
// Save latest found *.wag file's path (Can be used to open the file, the name can't)
- wagFilePath = file->getPath();
+ wagFileNode = *file;
wagFileCount++; // Count found *.wag files
}
}
@@ -2298,7 +2298,7 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL
// WinAGI produces *.wag file with interpreter version, game name and other parameters.
// If there's exactly one *.wag file and it parses successfully then we'll use its information.
- if (wagFileCount == 1 && wagFileParser.parse(wagFilePath.c_str())) {
+ if (wagFileCount == 1 && wagFileParser.parse(wagFileNode)) {
matchedUsingWag = true;
const WagProperty *wagAgiVer = wagFileParser.getProperty(WagProperty::PC_INTVERSION);
diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp
index 77dc180f14..5a49951183 100644
--- a/engines/agi/wagparser.cpp
+++ b/engines/agi/wagparser.cpp
@@ -173,14 +173,14 @@ bool WagFileParser::checkWagVersion(Common::SeekableReadStream &stream) {
}
}
-bool WagFileParser::parse(const char *filename) {
+bool WagFileParser::parse(const Common::FilesystemNode &node) {
Common::File file;
WagProperty property; // Temporary property used for reading
Common::MemoryReadStream *stream = NULL; // The file is to be read fully into memory and handled using this
_parsedOk = false; // We haven't parsed the file yet
- if (file.open(filename)) { // Open the file
+ if (file.open(node)) { // Open the file
stream = file.readStream(file.size()); // Read the file into memory
if (stream != NULL && stream->size() == file.size()) { // Check that the whole file was read into memory
if (checkWagVersion(*stream)) { // Check that WinAGI version string is valid
@@ -202,15 +202,15 @@ bool WagFileParser::parse(const char *filename) {
_parsedOk = endOfProperties(*stream) && property.readOk();
if (!_parsedOk) // Error parsing stream
- warning("Error parsing WAG file (%s). WAG file ignored", filename);
+ warning("Error parsing WAG file (%s). WAG file ignored", node.getPath().c_str());
} else // Invalid WinAGI version string or it couldn't be read
- warning("Invalid WAG file (%s) version or error reading it. WAG file ignored", filename);
+ warning("Invalid WAG file (%s) version or error reading it. WAG file ignored", node.getPath().c_str());
} else // Couldn't fully read file into memory
- warning("Error reading WAG file (%s) into memory. WAG file ignored", filename);
+ warning("Error reading WAG file (%s) into memory. WAG file ignored", node.getPath().c_str());
} else // Couldn't open file
- warning("Couldn't open WAG file (%s). WAG file ignored", filename);
+ warning("Couldn't open WAG file (%s). WAG file ignored", node.getPath().c_str());
- if (stream != NULL) delete stream; // If file was read into memory, deallocate that buffer
+ delete stream;
return _parsedOk;
}
diff --git a/engines/agi/wagparser.h b/engines/agi/wagparser.h
index 827720ac85..89349a8ee2 100644
--- a/engines/agi/wagparser.h
+++ b/engines/agi/wagparser.h
@@ -223,7 +223,7 @@ public:
* @param filename Name of the file to be parsed.
* @return True if parsed successfully, false otherwise.
*/
- bool parse(const char *filename);
+ bool parse(const Common::FilesystemNode &node);
/**
* Get list of the loaded properties.