[Scummvm-git-logs] scummvm master -> 1f5a57a54c4d70198b40c31dff49f4356821e403
sev-
sev at scummvm.org
Wed Mar 29 11:02:28 CEST 2017
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:
1f5a57a54c DIRECTOR: Convert HFS file paths to Posix
Commit: 1f5a57a54c4d70198b40c31dff49f4356821e403
https://github.com/scummvm/scummvm/commit/1f5a57a54c4d70198b40c31dff49f4356821e403
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-03-29T08:35:33+02:00
Commit Message:
DIRECTOR: Convert HFS file paths to Posix
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/util.cpp
engines/director/util.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 0f2110d..4c02bf6 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -30,6 +30,7 @@
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
#include "director/sound.h"
+#include "director/util.h"
namespace Director {
@@ -180,6 +181,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
if (movie.type != VOID) {
movie.toString();
+ Common::String movieFilename = convertPath(*movie.u.s);
Common::String cleanedFilename;
bool fileExists = false;
@@ -187,30 +189,30 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
if (_vm->getPlatform() == Common::kPlatformMacintosh) {
Common::MacResManager resMan;
- for (const byte *p = (const byte *)movie.u.s->c_str(); *p; p++)
+ for (const byte *p = (const byte *)movieFilename.c_str(); *p; p++)
if (*p >= 0x20 && *p <= 0x7f)
cleanedFilename += (const char) *p;
- if (resMan.open(*movie.u.s)) {
+ if (resMan.open(movieFilename)) {
fileExists = true;
- cleanedFilename = *movie.u.s;
- } else if (!movie.u.s->equals(cleanedFilename) && resMan.open(cleanedFilename)) {
+ cleanedFilename = movieFilename;
+ } else if (!movieFilename.equals(cleanedFilename) && resMan.open(cleanedFilename)) {
fileExists = true;
}
} else {
Common::File file;
- cleanedFilename = *movie.u.s + ".MMM";
+ cleanedFilename = movieFilename + ".MMM";
- if (file.open(*movie.u.s)) {
+ if (file.open(movieFilename)) {
fileExists = true;
- cleanedFilename = *movie.u.s;
- } else if (!movie.u.s->equals(cleanedFilename) && file.open(cleanedFilename)) {
+ cleanedFilename = movieFilename;
+ } else if (!movieFilename.equals(cleanedFilename) && file.open(cleanedFilename)) {
fileExists = true;
}
}
if (!fileExists) {
- warning("Movie %s does not exist", movie.u.s->c_str());
+ warning("Movie %s does not exist", movieFilename.c_str());
return;
}
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index dbd1cd3..cf7e122 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -105,4 +105,41 @@ Common::String *toLowercaseMac(Common::String *s) {
return res;
}
+Common::String convertPath(Common::String &path) {
+ if (path.empty())
+ return path;
+
+ if (!path.contains(':')) {
+ return path;
+ }
+
+ if (path[0] != ':') {
+ warning("convertPath: unsupported absolute path '%s'", path.c_str());
+
+ return path;
+ }
+
+ Common::String res;
+ int idx = 0;
+
+ if (path.hasPrefix(":::")) {
+ res = "../";
+ idx = 3;
+ } else {
+ res = "./";
+ idx = 1;
+ }
+
+ while (idx != path.size()) {
+ if (path[idx] == ':')
+ res += '/';
+ else
+ res += path[idx];
+
+ idx++;
+ }
+
+ return res;
+}
+
} // End of namespace Director
diff --git a/engines/director/util.h b/engines/director/util.h
index c312400..e5ce0f5 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -34,6 +34,8 @@ char *numToCastNum(int num);
Common::String *toLowercaseMac(Common::String *s);
+Common::String convertPath(Common::String &path);
+
void processQuitEvent(); // events.cpp
} // End of namespace Director
More information about the Scummvm-git-logs
mailing list