[Scummvm-git-logs] scummvm master -> ade161c7c9b68d1e192d1a75a35fa85902833edf

elasota noreply at scummvm.org
Thu Dec 28 19:11:17 UTC 2023


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:
ade161c7c9 MTROPOLIS: Improve Punycode handling in VFS


Commit: ade161c7c9b68d1e192d1a75a35fa85902833edf
    https://github.com/scummvm/scummvm/commit/ade161c7c9b68d1e192d1a75a35fa85902833edf
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2023-12-28T14:10:55-05:00

Commit Message:
MTROPOLIS: Improve Punycode handling in VFS

This should fix MTI Mac not booting

Changed paths:
    engines/mtropolis/vfs.cpp


diff --git a/engines/mtropolis/vfs.cpp b/engines/mtropolis/vfs.cpp
index 42e7b6449f6..f9280a3cb68 100644
--- a/engines/mtropolis/vfs.cpp
+++ b/engines/mtropolis/vfs.cpp
@@ -44,8 +44,7 @@ VirtualFileSystem::VirtualFileSystem(const VirtualFileSystemLayout &layout) : _p
 			TempLayoutFile tlf;
 			tlf._archiveMember = arcMember;
 			tlf._expandedPath = (prefix + arcMember->getPathInArchive().toString(_pathSeparator));
-			tlf._expandedPathCanonical = tlf._expandedPath;
-			tlf._expandedPathCanonical.toLowercase();
+			tlf._expandedPathCanonical = canonicalizePath(Common::Path(tlf._expandedPath, _pathSeparator));
 
 			Common::HashMap<Common::String, uint>::const_iterator indexIt = pathToTLF.find(tlf._expandedPath);
 
@@ -59,9 +58,7 @@ VirtualFileSystem::VirtualFileSystem(const VirtualFileSystemLayout &layout) : _p
 	}
 
 	for (const VirtualFileSystemLayout::PathJunction &pjunc : layout._pathJunctions) {
-		Common::String destPathFile = pjunc._destPath;
-		destPathFile.toLowercase();
-
+		Common::String destPathFile = canonicalizePath(Common::Path(pjunc._destPath, _pathSeparator));
 		Common::String destPathDir = destPathFile + _pathSeparator;
 
 		for (uint i = 0; i < tempLayoutFiles.size(); i++) {
@@ -194,7 +191,14 @@ bool VirtualFileSystem::sortVirtualFiles(const VirtualFile &a, const VirtualFile
 }
 
 Common::String VirtualFileSystem::canonicalizePath(const Common::Path &path) const {
-	Common::String result = path.toString(_pathSeparator);
+	Common::StringArray components = path.splitComponents();
+
+	for (Common::String &component : components) {
+		if (Common::punycode_hasprefix(component))
+			component = Common::punycode_decode(component).encode(Common::kUtf8);
+	}
+
+	Common::String result = Common::Path::joinComponents(components).toString(_pathSeparator);
 	result.toLowercase();
 
 	return result;




More information about the Scummvm-git-logs mailing list