[Scummvm-git-logs] scummvm master -> 31476365f55ba53ce5e4db5e314e9912d59ec199
bluegr
noreply at scummvm.org
Sun Aug 4 10:00:20 UTC 2024
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:
31476365f5 TETRAEDGE: Switch path suffixes to Common::Path in findFile()
Commit: 31476365f55ba53ce5e4db5e314e9912d59ec199
https://github.com/scummvm/scummvm/commit/31476365f55ba53ce5e4db5e314e9912d59ec199
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2024-08-04T13:00:01+03:00
Commit Message:
TETRAEDGE: Switch path suffixes to Common::Path in findFile()
This avoids constant re-creation of Common::Paths from strings when
looking for files and constructing file paths
Changed paths:
engines/tetraedge/te/te_core.cpp
diff --git a/engines/tetraedge/te/te_core.cpp b/engines/tetraedge/te/te_core.cpp
index ea6f3a8081d..6f002c05c57 100644
--- a/engines/tetraedge/te/te_core.cpp
+++ b/engines/tetraedge/te/te_core.cpp
@@ -157,8 +157,8 @@ Common::Path TeCore::findFile(const Common::Path &path) const {
fname = fname.substr(0, fname.find('#'));
const Common::Path dir = path.getParent();
- static const char *pathSuffixes[] = {
- nullptr, // no suffix
+ static const Common::Path pathSuffixes[] = {
+ "", // no suffix
"PC-MacOSX",
"PC-PS3-Android-MacOSX",
"PC-MacOSX-Android-iPhone-iPad",
@@ -207,7 +207,7 @@ Common::Path TeCore::findFile(const Common::Path &path) const {
"Part3-Full/HD", // Amerzone
};
- const Common::Path langs[] = {
+ static const Common::Path langs[] = {
Common::Path(language()),
"en",
"de-es-fr-it-en",
@@ -226,10 +226,10 @@ Common::Path TeCore::findFile(const Common::Path &path) const {
for (int langtype = 0; langtype < ARRAYSIZE(langs); langtype++) {
const Common::Path &lang = langs[langtype];
for (int i = 0; i < ARRAYSIZE(pathSuffixes); i++) {
- const char *suffix = pathSuffixes[i];
+ Common::Path suffix = pathSuffixes[i];
Common::Path testPath = dir;
- if (suffix)
+ if (!suffix.empty())
testPath.joinInPlace(suffix);
if (!lang.empty())
testPath.joinInPlace(lang);
@@ -238,7 +238,7 @@ Common::Path TeCore::findFile(const Common::Path &path) const {
return testPath;
// also try the other way around
- if (!lang.empty() && suffix) {
+ if (!lang.empty() && !suffix.empty()) {
testPath = dir.join(lang).joinInPlace(suffix).join(fname);
if (Common::File::exists(testPath))
return testPath;
More information about the Scummvm-git-logs
mailing list