[Scummvm-git-logs] scummvm master -> 075cd31a49ca29f26a25be8805790d289c365299
criezy
criezy at scummvm.org
Tue Feb 16 00:05:20 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
075cd31a49 AGS: Do case insensitive search for game files and sub-directories
Commit: 075cd31a49ca29f26a25be8805790d289c365299
https://github.com/scummvm/scummvm/commit/075cd31a49ca29f26a25be8805790d289c365299
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-02-16T00:05:01Z
Commit Message:
AGS: Do case insensitive search for game files and sub-directories
Changed paths:
engines/ags/shared/util/stdio_compat.cpp
diff --git a/engines/ags/shared/util/stdio_compat.cpp b/engines/ags/shared/util/stdio_compat.cpp
index 6ec93ea7d8..4ec29b290b 100644
--- a/engines/ags/shared/util/stdio_compat.cpp
+++ b/engines/ags/shared/util/stdio_compat.cpp
@@ -63,17 +63,32 @@ Common::FSNode getFSNode(const char *path) {
if (filePath.hasPrefix("./"))
filePath = Common::String(filePath.c_str() + 2);
+ // Use FSDirectory for case-insensitive search
+ Common::SharedPtr<Common::FSDirectory> dir(new Common::FSDirectory(node));
+
// Iterate through any further subfolders or filename
size_t separator;
while ((separator = filePath.find('/')) != Common::String::npos) {
- node = node.getChild(filePath.substr(0, separator));
+ dir.reset(dir->getSubDirectory(filePath.substr(0, separator)));
+ if (!dir)
+ return Common::FSNode();
filePath = Common::String(filePath.c_str() + separator + 1);
}
- if (!filePath.empty())
- node = node.getChild(filePath);
+ if (filePath.empty())
+ return dir->getFSNode();
+
+ if (dir->hasFile(filePath)) {
+ Common::ArchiveMemberPtr file = dir->getMember(filePath);
+ if (file)
+ return dir->getFSNode().getChild(file->getName());
+ }
+
+ dir.reset(dir->getSubDirectory(filePath));
+ if (dir)
+ return dir->getFSNode();
- return node;
+ return Common::FSNode();
}
int ags_file_exists(const char *path) {
More information about the Scummvm-git-logs
mailing list