From 72376681afad3e57ffa2134d76ad649a38c86023 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 26 Dec 2016 11:55:06 +0100 Subject: 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. --- test/engines/wintermute/path_utils.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test/engines/wintermute') diff --git a/test/engines/wintermute/path_utils.h b/test/engines/wintermute/path_utils.h index 3cacf47fd9..26f3404396 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() { -- cgit v1.2.3