[Scummvm-git-logs] scummvm master -> e74c53054b401f0afb216c1a2c398f5e0726d63b
npjg
nathanael.gentrydb8 at gmail.com
Wed Aug 5 03:57:41 UTC 2020
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:
e74c53054b DIRECTOR: Search for D4 Mac file extensions
Commit: e74c53054b401f0afb216c1a2c398f5e0726d63b
https://github.com/scummvm/scummvm/commit/e74c53054b401f0afb216c1a2c398f5e0726d63b
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-08-04T23:57:22-04:00
Commit Message:
DIRECTOR: Search for D4 Mac file extensions
Changed paths:
engines/director/util.cpp
engines/director/util.h
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 4ad4468e92..2106f6ca2a 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -375,6 +375,8 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
if (!opened && recursive) {
// Hmmm. We couldn't find the path as is.
// Let's try to translate file path into 8.3 format
+ Common::String addedexts;
+
if (g_director->getPlatform() == Common::kPlatformWindows && g_director->getVersion() < 5) {
convPath.clear();
const char *ptr = initialPath.c_str();
@@ -397,24 +399,15 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
ptr++;
}
- const char *exts[] = { ".MMM", ".DIR", ".DXR", 0 };
- for (int i = 0; exts[i] && addexts; ++i) {
- Common::String newpath = convPath +
- (strcmp(exts[i], ".MMM") == 0 ? convertMacFilename(component.c_str()) : component.c_str()) + exts[i];
-
- debug(2, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
-
- Common::String res = pathMakeRelative(newpath, false, false);
-
- if (testPath(res))
- return res;
- }
- } else if (g_director->getPlatform() == Common::kPlatformMacintosh && addexts) {
- // Try adding an extension D4 Mac movies
- Common::String res = pathMakeRelative(convPath + ".Dir", false, false);
+ if (addexts)
+ addedexts = testExtensions(component, initialPath, convPath);
+ } else {
+ if (addexts)
+ addedexts = testExtensions(initialPath, initialPath, convPath);
+ }
- if (testPath(res))
- return res;
+ if (!addedexts.empty()) {
+ return addedexts;
}
return initialPath; // Anyway nothing good is happening
@@ -426,6 +419,21 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
return initialPath;
}
+ Common::String testExtensions(Common::String component, Common::String initialPath, Common::String convPath) {
+ const char *exts[] = { ".MMM", ".DIR", ".Dir", ".DXR", ".Dxr", 0 };
+ for (int i = 0; exts[i]; ++i) {
+ Common::String newpath = convPath + (strcmp(exts[i], ".MMM") == 0 ? convertMacFilename(component.c_str()) : component.c_str()) + exts[i];
+
+ debug(2, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
+ Common::String res = pathMakeRelative(newpath, false, false);
+
+ if (testPath(res))
+ return res;
+ }
+
+ return Common::String();
+}
+
Common::String getFileName(Common::String path) {
while (path.contains('/')) {
int pos = path.find('/');
diff --git a/engines/director/util.h b/engines/director/util.h
index 037a62d353..ebca11bf7d 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -42,6 +42,8 @@ bool testPath(Common::String &path);
Common::String pathMakeRelative(Common::String path, bool recursive = true, bool addexts = true);
+ Common::String testExtensions(Common::String component, Common::String initialPath, Common::String convPath);
+
Common::String getFileName(Common::String path);
Common::String stripMacPath(const char *name);
More information about the Scummvm-git-logs
mailing list