[Scummvm-git-logs] scummvm master -> 8477c4beb2de1ad70f355386d745d4f9c1f5d98b
sev-
sev at scummvm.org
Mon Dec 26 16:15:47 CET 2016
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9c074fd163 WINTERMUTE: Remove commented lines from dctypes
b981edd1f7 WINTERMUTE: Turn AnsiString into Common::String in PathUtil
e3fdd8d5fe WINTERMUTE: Add tests for engines/wintermute/path_utils.h
9339490236 WINTERMUTE: only access -1th char of string if length > 0 in getFileName
72376681af WINTERMUTE: Try to "correctly" handle dir paths
257d7e8fe0 WINTERMUTE: Don't mix different path separators.
a14d3865ad WINTERMUTE: Use PathUtil::normalizeFileName in correctSlashes
8477c4beb2 Merge pull request #874 from tobiatesan/fix_getfilename_cr5
Commit: 9c074fd16341b4cc4e6d96aa0bd44a15a2553ee7
https://github.com/scummvm/scummvm/commit/9c074fd16341b4cc4e6d96aa0bd44a15a2553ee7
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-03-31T17:06:08+02:00
Commit Message:
WINTERMUTE: Remove commented lines from dctypes
Changed paths:
engines/wintermute/dctypes.h
diff --git a/engines/wintermute/dctypes.h b/engines/wintermute/dctypes.h
index 90340f4..571ce21 100644
--- a/engines/wintermute/dctypes.h
+++ b/engines/wintermute/dctypes.h
@@ -37,9 +37,6 @@
namespace Wintermute {
-//typedef std::string AnsiString;
-//typedef std::string Utf8String;
-//typedef std::wstring WideString;
typedef Common::String AnsiString;
typedef Common::String Utf8String;
typedef Common::U32String WideString;
Commit: b981edd1f76ab303df3028e4134ee54c787cab5a
https://github.com/scummvm/scummvm/commit/b981edd1f76ab303df3028e4134ee54c787cab5a
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-03-31T17:06:13+02:00
Commit Message:
WINTERMUTE: Turn AnsiString into Common::String in PathUtil
AnsiString is already typedefd to Common::String
Changed paths:
engines/wintermute/utils/path_util.cpp
engines/wintermute/utils/path_util.h
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp
index 7131171..db98606 100644
--- a/engines/wintermute/utils/path_util.cpp
+++ b/engines/wintermute/utils/path_util.cpp
@@ -32,8 +32,8 @@
namespace Wintermute {
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::unifySeparators(const AnsiString &path) {
- AnsiString newPath = path;
+Common::String PathUtil::unifySeparators(const Common::String &path) {
+ Common::String newPath = path;
for (uint32 i = 0; i < newPath.size(); i++) {
if (newPath[i] == '\\') {
@@ -45,16 +45,16 @@ AnsiString PathUtil::unifySeparators(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::normalizeFileName(const AnsiString &path) {
- AnsiString newPath = unifySeparators(path);
+Common::String PathUtil::normalizeFileName(const Common::String &path) {
+ Common::String newPath = unifySeparators(path);
newPath.toLowercase();
return newPath;
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) {
- AnsiString newPath1 = unifySeparators(path1);
- AnsiString newPath2 = unifySeparators(path2);
+Common::String PathUtil::combine(const Common::String &path1, const Common::String &path2) {
+ Common::String newPath1 = unifySeparators(path1);
+ Common::String newPath2 = unifySeparators(path2);
if (!newPath1.hasSuffix("/") && !newPath2.hasPrefix("/")) {
newPath1 += "/";
@@ -64,15 +64,15 @@ AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::getDirectoryName(const AnsiString &path) {
- AnsiString newPath = unifySeparators(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());
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::getFileName(const AnsiString &path) {
- AnsiString newPath = unifySeparators(path);
+Common::String PathUtil::getFileName(const Common::String &path) {
+ Common::String newPath = unifySeparators(path);
Common::String lastPart = Common::lastPathComponent(newPath, '/');
if (lastPart[lastPart.size() - 1 ] != '/') {
return lastPart;
@@ -82,10 +82,10 @@ AnsiString PathUtil::getFileName(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) {
- AnsiString fileName = getFileName(path);
+Common::String PathUtil::getFileNameWithoutExtension(const Common::String &path) {
+ Common::String fileName = getFileName(path);
// TODO: Prettify this.
- AnsiString extension = Common::lastPathComponent(fileName, '.');
+ Common::String extension = Common::lastPathComponent(fileName, '.');
for (uint32 i = 0; i < extension.size() + 1; i++) {
fileName.deleteLastChar();
}
@@ -93,8 +93,8 @@ AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::getExtension(const AnsiString &path) {
- AnsiString fileName = getFileName(path);
+Common::String PathUtil::getExtension(const Common::String &path) {
+ Common::String fileName = getFileName(path);
return Common::lastPathComponent(path, '.');
}
diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h
index 264dc5d..cc64fb9 100644
--- a/engines/wintermute/utils/path_util.h
+++ b/engines/wintermute/utils/path_util.h
@@ -35,13 +35,13 @@ namespace Wintermute {
class PathUtil {
public:
- static AnsiString unifySeparators(const AnsiString &path);
- static AnsiString normalizeFileName(const AnsiString &path);
- static AnsiString combine(const AnsiString &path1, const AnsiString &path2);
- static AnsiString getDirectoryName(const AnsiString &path);
- static AnsiString getFileName(const AnsiString &path);
- static AnsiString getFileNameWithoutExtension(const AnsiString &path);
- static AnsiString getExtension(const AnsiString &path);
+ static Common::String unifySeparators(const Common::String &path);
+ static Common::String normalizeFileName(const Common::String &path);
+ static Common::String combine(const Common::String &path1, const Common::String &path2);
+ static Common::String getDirectoryName(const Common::String &path);
+ static Common::String getFileName(const Common::String &path);
+ static Common::String getFileNameWithoutExtension(const Common::String &path);
+ static Common::String getExtension(const Common::String &path);
};
} // End of namespace Wintermute
Commit: e3fdd8d5fe5b739b28c67539bbdb0b596f9dacbe
https://github.com/scummvm/scummvm/commit/e3fdd8d5fe5b739b28c67539bbdb0b596f9dacbe
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-12-26T10:41:48+01:00
Commit Message:
WINTERMUTE: Add tests for engines/wintermute/path_utils.h
Changed paths:
A test/engines/wintermute/path_utils.h
test/module.mk
diff --git a/test/engines/wintermute/path_utils.h b/test/engines/wintermute/path_utils.h
new file mode 100644
index 0000000..c3f1776
--- /dev/null
+++ b/test/engines/wintermute/path_utils.h
@@ -0,0 +1,200 @@
+#include <cxxtest/TestSuite.h>
+#include "engines/wintermute/utils/path_util.h"
+/**
+ * Test suite for the functions in engines/wintermute/utils/path_util.h
+ *
+ * NOTE: This is not a prescription;
+ * this was not written by the original engine author;
+ * this was not written by the engine porter.
+ *
+ * It might, however, help to spot variations in behavior that are introduced by modifications
+ */
+
+class PathUtilTestSuite : public CxxTest::TestSuite {
+ public:
+ const Common::String unixPath;
+ const Common::String unixCapPath;
+ const Common::String windowsPath;
+ const Common::String windowsCapPath;
+ const Common::String emptyString;
+ const Common::String dualExtPath;
+ const Common::String manyExtPath;
+ const Common::String mixedSlashesPath1;
+ const Common::String mixedSlashesPath2;
+ const Common::String unixRelativePath;
+ const Common::String windowsRelativePath;
+ PathUtilTestSuite () :
+ unixPath("/some/file.ext"),
+ unixCapPath("/SOME/FILE.EXT"),
+ windowsPath("C:\\some\\file.ext"),
+ windowsCapPath("C:\\SOME\\FILE.EXT"),
+ emptyString(""),
+ dualExtPath("/some/file.tar.gz"),
+ manyExtPath("/some/file.tar.bz2.gz.zip"),
+ mixedSlashesPath1("C:\\this/IS_REALLY\\weird.exe"),
+ mixedSlashesPath2("/pretty\\weird/indeed.txt"),
+ unixRelativePath("some/file.ext"),
+ windowsRelativePath("some\\file.ext")
+ {}
+ void test_getdirectoryname() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(unixPath),
+ Common::String("/some/")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(unixCapPath),
+ Common::String("/SOME/")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(windowsPath),
+ Common::String("C:\\some\\")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(windowsCapPath),
+ Common::String("C:\\SOME\\")
+ );
+ }
+
+ void test_getfilename() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(unixPath),
+ Common::String("file.ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(unixCapPath),
+ Common::String("FILE.EXT")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(windowsPath),
+ Common::String("file.ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(windowsCapPath),
+ Common::String("FILE.EXT")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(unixRelativePath),
+ Common::String("file.ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(windowsRelativePath),
+ Common::String("file.ext")
+ );
+ }
+
+ void test_getextension() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(windowsPath),
+ Common::String("ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(windowsCapPath),
+ Common::String("EXT")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(dualExtPath),
+ Common::String("gz")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(manyExtPath),
+ Common::String("zip")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(unixRelativePath),
+ Common::String("ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(windowsRelativePath),
+ Common::String("ext")
+ );
+ }
+
+ void test_getfilenamewithoutextension() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(windowsPath),
+ Common::String("file")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(windowsCapPath),
+ Common::String("FILE")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(dualExtPath),
+ Common::String("file.tar")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(manyExtPath),
+ Common::String("file.tar.bz2.gz")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(unixRelativePath),
+ Common::String("file")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(windowsRelativePath),
+ Common::String("file")
+ );
+ }
+
+ void test_combine_identity() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(windowsPath) +
+ Wintermute::PathUtil::getFileNameWithoutExtension(windowsPath) +
+ "." +
+ Wintermute::PathUtil::getExtension(windowsPath),
+ windowsPath
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(windowsCapPath) +
+ Wintermute::PathUtil::getFileNameWithoutExtension(windowsCapPath) +
+ "." +
+ Wintermute::PathUtil::getExtension(windowsCapPath),
+ windowsCapPath
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(unixCapPath) +
+ Wintermute::PathUtil::getFileNameWithoutExtension(unixCapPath) +
+ "." +
+ Wintermute::PathUtil::getExtension(unixCapPath),
+ unixCapPath
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(manyExtPath) +
+ Wintermute::PathUtil::getFileNameWithoutExtension(manyExtPath) +
+ "." +
+ Wintermute::PathUtil::getExtension(manyExtPath),
+ manyExtPath
+ );
+ }
+
+ void test_normalize() {
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(windowsCapPath),
+ Common::String("c:/some/file.ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(windowsPath),
+ Common::String("c:/some/file.ext")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(mixedSlashesPath1),
+ Common::String("c:/this/is_really/weird.exe")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(mixedSlashesPath2),
+ Common::String("/pretty/weird/indeed.txt")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(emptyString),
+ emptyString
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(unixRelativePath),
+ unixRelativePath
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::normalizeFileName(windowsRelativePath),
+ unixRelativePath // NOT windows
+ );
+ }
+};
diff --git a/test/module.mk b/test/module.mk
index 11ee6bd..da469b4 100644
--- a/test/module.mk
+++ b/test/module.mk
@@ -5,8 +5,8 @@
#
######################################################################
-TESTS := $(srcdir)/test/common/*.h $(srcdir)/test/audio/*.h
-TEST_LIBS := audio/libaudio.a common/libcommon.a
+TESTS := $(srcdir)/test/common/*.h $(srcdir)/test/audio/*.h $(srcdir)/test/engines/wintermute/*.h
+TEST_LIBS := audio/libaudio.a common/libcommon.a engines/wintermute/libwintermute.a
#
TEST_FLAGS := --runner=StdioPrinter --no-std --no-eh --include=$(srcdir)/test/cxxtest_mingw.h
Commit: 93394902368a0fb2c25647f0d6205f5a43282933
https://github.com/scummvm/scummvm/commit/93394902368a0fb2c25647f0d6205f5a43282933
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-12-26T12:02:56+01:00
Commit Message:
WINTERMUTE: only access -1th char of string if length > 0 in getFileName
Fixes #6594
Changed paths:
engines/wintermute/utils/path_util.cpp
engines/wintermute/utils/path_util.h
test/engines/wintermute/path_utils.h
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp
index db98606..60a07f0 100644
--- a/engines/wintermute/utils/path_util.cpp
+++ b/engines/wintermute/utils/path_util.cpp
@@ -63,6 +63,10 @@ Common::String PathUtil::combine(const Common::String &path1, const Common::Stri
return newPath1 + newPath2;
}
+bool PathUtil::hasTrailingSlash(const Common::String &path) {
+ return (path.size() > 0 && path[path.size() - 1 ] == '/');
+}
+
//////////////////////////////////////////////////////////////////////////
Common::String PathUtil::getDirectoryName(const Common::String &path) {
Common::String newPath = unifySeparators(path);
@@ -74,10 +78,10 @@ Common::String PathUtil::getDirectoryName(const Common::String &path) {
Common::String PathUtil::getFileName(const Common::String &path) {
Common::String newPath = unifySeparators(path);
Common::String lastPart = Common::lastPathComponent(newPath, '/');
- if (lastPart[lastPart.size() - 1 ] != '/') {
- return lastPart;
+ if (hasTrailingSlash(newPath)) {
+ return Common::String("");
} else {
- return path;
+ return lastPart;
}
}
diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h
index cc64fb9..8050cdf 100644
--- a/engines/wintermute/utils/path_util.h
+++ b/engines/wintermute/utils/path_util.h
@@ -42,6 +42,7 @@ public:
static Common::String getFileName(const Common::String &path);
static Common::String getFileNameWithoutExtension(const Common::String &path);
static Common::String getExtension(const Common::String &path);
+ static bool hasTrailingSlash(const Common::String &path);
};
} // End of namespace Wintermute
diff --git a/test/engines/wintermute/path_utils.h b/test/engines/wintermute/path_utils.h
index c3f1776..3cacf47 100644
--- a/test/engines/wintermute/path_utils.h
+++ b/test/engines/wintermute/path_utils.h
@@ -53,6 +53,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Wintermute::PathUtil::getDirectoryName(windowsCapPath),
Common::String("C:\\SOME\\")
);
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(emptyString),
+ Common::String("")
+ );
}
void test_getfilename() {
@@ -73,6 +77,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("FILE.EXT")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getFileName(unixRelativePath),
Common::String("file.ext")
);
@@ -80,6 +88,14 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Wintermute::PathUtil::getFileName(windowsRelativePath),
Common::String("file.ext")
);
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(windowsDirPath),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(unixDirPath),
+ Common::String("")
+ );
}
void test_getextension() {
@@ -92,6 +108,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("EXT")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getExtension(dualExtPath),
Common::String("gz")
);
@@ -119,6 +139,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("FILE")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getFileNameWithoutExtension(dualExtPath),
Common::String("file.tar")
);
Commit: 72376681afad3e57ffa2134d76ad649a38c86023
https://github.com/scummvm/scummvm/commit/72376681afad3e57ffa2134d76ad649a38c86023
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-12-26T12:05:41+01:00
Commit Message:
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.
Changed paths:
engines/wintermute/utils/path_util.cpp
test/engines/wintermute/path_utils.h
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp
index 60a07f0..8518f89 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());
+ }
}
//////////////////////////////////////////////////////////////////////////
diff --git a/test/engines/wintermute/path_utils.h b/test/engines/wintermute/path_utils.h
index 3cacf47..26f3404 100644
--- a/test/engines/wintermute/path_utils.h
+++ b/test/engines/wintermute/path_utils.h
@@ -23,6 +23,8 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
const Common::String mixedSlashesPath2;
const Common::String unixRelativePath;
const Common::String windowsRelativePath;
+ const Common::String unixDirPath;
+ const Common::String windowsDirPath;
PathUtilTestSuite () :
unixPath("/some/file.ext"),
unixCapPath("/SOME/FILE.EXT"),
@@ -34,7 +36,9 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
mixedSlashesPath1("C:\\this/IS_REALLY\\weird.exe"),
mixedSlashesPath2("/pretty\\weird/indeed.txt"),
unixRelativePath("some/file.ext"),
- windowsRelativePath("some\\file.ext")
+ windowsRelativePath("some\\file.ext"),
+ unixDirPath("/some/dir/"),
+ windowsDirPath("C:\\some\\dir\\")
{}
void test_getdirectoryname() {
TS_ASSERT_EQUALS(
@@ -57,6 +61,14 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Wintermute::PathUtil::getDirectoryName(emptyString),
Common::String("")
);
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(unixDirPath),
+ Common::String("/some/dir/")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(windowsDirPath),
+ Common::String("C:\\some\\dir\\")
+ );
}
void test_getfilename() {
Commit: 257d7e8fe04f942d7c85d27181601774cb853463
https://github.com/scummvm/scummvm/commit/257d7e8fe04f942d7c85d27181601774cb853463
Author: Ryper_Zsolt (akormanyzsolt at gmail.com)
Date: 2016-12-26T15:09:16+01:00
Commit Message:
WINTERMUTE: Don't mix different path separators.
Fixes #7068
Changed paths:
engines/wintermute/base/file/base_disk_file.cpp
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index 82a9e24..b051c2e 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -135,7 +135,14 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
}
// File wasn't found in SearchMan, try to parse the path as a relative path.
if (!file) {
- Common::FSNode searchNode = getNodeForRelativePath(filename);
+ Common::String filenameBackSlash = filename;
+ for (size_t i = 0; i < filenameBackSlash.size(); i++) {
+ if (filenameBackSlash[i] == '/') {
+ filenameBackSlash.setChar('\\', i);
+ }
+ }
+
+ Common::FSNode searchNode = getNodeForRelativePath(filenameBackSlash);
if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) {
file = searchNode.createReadStream();
}
Commit: a14d3865ad4fbe2cf688e180642bdc5103c5280b
https://github.com/scummvm/scummvm/commit/a14d3865ad4fbe2cf688e180642bdc5103c5280b
Author: Tobia Tesan (tobia.tesan at gmail.com)
Date: 2016-12-26T15:09:34+01:00
Commit Message:
WINTERMUTE: Use PathUtil::normalizeFileName in correctSlashes
Changed paths:
engines/wintermute/base/file/base_disk_file.cpp
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp
index b051c2e..30c5026 100644
--- a/engines/wintermute/base/file/base_disk_file.cpp
+++ b/engines/wintermute/base/file/base_disk_file.cpp
@@ -29,6 +29,7 @@
#include "engines/wintermute/dcgf.h"
#include "engines/wintermute/base/file/base_disk_file.h"
#include "engines/wintermute/base/base_file_manager.h"
+#include "engines/wintermute/utils/path_util.h"
#include "common/stream.h"
#include "common/memstream.h"
#include "common/file.h"
@@ -37,6 +38,7 @@
#include "common/tokenizer.h"
#include "common/config-manager.h"
+
namespace Wintermute {
void correctSlashes(Common::String &fileName) {
@@ -135,14 +137,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) {
}
// File wasn't found in SearchMan, try to parse the path as a relative path.
if (!file) {
- Common::String filenameBackSlash = filename;
- for (size_t i = 0; i < filenameBackSlash.size(); i++) {
- if (filenameBackSlash[i] == '/') {
- filenameBackSlash.setChar('\\', i);
- }
- }
-
- Common::FSNode searchNode = getNodeForRelativePath(filenameBackSlash);
+ Common::FSNode searchNode = getNodeForRelativePath(PathUtil::normalizeFileName(filename));
if (searchNode.exists() && !searchNode.isDirectory() && searchNode.isReadable()) {
file = searchNode.createReadStream();
}
Commit: 8477c4beb2de1ad70f355386d745d4f9c1f5d98b
https://github.com/scummvm/scummvm/commit/8477c4beb2de1ad70f355386d745d4f9c1f5d98b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-12-26T16:15:38+01:00
Commit Message:
Merge pull request #874 from tobiatesan/fix_getfilename_cr5
WINTERMUTE: Fix PathUtils and add workaround for mixed separators
Changed paths:
A test/engines/wintermute/path_utils.h
engines/wintermute/base/file/base_disk_file.cpp
engines/wintermute/dctypes.h
engines/wintermute/utils/path_util.cpp
engines/wintermute/utils/path_util.h
test/module.mk
More information about the Scummvm-git-logs
mailing list