aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTobia Tesan2016-12-26 11:55:06 +0100
committerTobia Tesan2016-12-26 12:05:41 +0100
commit72376681afad3e57ffa2134d76ad649a38c86023 (patch)
tree2703dc08691260642a8604283909cf543dce08f3 /engines
parent93394902368a0fb2c25647f0d6205f5a43282933 (diff)
downloadscummvm-rg350-72376681afad3e57ffa2134d76ad649a38c86023.tar.gz
scummvm-rg350-72376681afad3e57ffa2134d76ad649a38c86023.tar.bz2
scummvm-rg350-72376681afad3e57ffa2134d76ad649a38c86023.zip
WINTERMUTE: Try to "correctly" handle dir paths
I put scare quotes around "correctly" because I can't swear this is the intended behaviour of the original interpreter. I don't think accessing filenames that end with / in the .DCPs is even defined behaviour, so this is a best guess.
Diffstat (limited to 'engines')
-rw-r--r--engines/wintermute/utils/path_util.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp
index 60a07f0bf0..8518f8968f 100644
--- a/engines/wintermute/utils/path_util.cpp
+++ b/engines/wintermute/utils/path_util.cpp
@@ -71,7 +71,11 @@ bool PathUtil::hasTrailingSlash(const Common::String &path) {
Common::String PathUtil::getDirectoryName(const Common::String &path) {
Common::String newPath = unifySeparators(path);
Common::String filename = getFileName(path);
- return Common::String(path.c_str(), path.size() - filename.size());
+ if (hasTrailingSlash(newPath)) {
+ return path;
+ } else {
+ return Common::String(path.c_str(), path.size() - filename.size());
+ }
}
//////////////////////////////////////////////////////////////////////////