[Scummvm-git-logs] scummvm master -> 5bb4fa3a31163a939059f5da9dfbc29b83c708fa

sev- noreply at scummvm.org
Tue Jul 14 19:17:41 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
5bb4fa3a31 COMMON: Make Common::Arhive::dumpArchive() also dump Mac Resouce forks


Commit: 5bb4fa3a31163a939059f5da9dfbc29b83c708fa
    https://github.com/scummvm/scummvm/commit/5bb4fa3a31163a939059f5da9dfbc29b83c708fa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2026-07-14T21:17:32+02:00

Commit Message:
COMMON: Make Common::Arhive::dumpArchive() also dump Mac Resouce forks

Changed paths:
    common/archive.cpp


diff --git a/common/archive.cpp b/common/archive.cpp
index fa9acee4602..24c9f117dfc 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -123,14 +123,39 @@ SeekableReadStream *Archive::createReadStreamForMemberAltStream(const Path &path
 	return nullptr;
 }
 
+static Common::Error dumpStream(Common::SeekableReadStream *stream, const Common::Path &destPath, const Common::Path &filePath, Common::String ext) {
+	uint32 len = stream->size();
+	byte *data = (byte *)malloc(stream->size());
+
+	stream->read(data, len);
+
+	Common::DumpFile out;
+	Common::Path outPath = destPath.join(filePath).append(ext);
+
+	if (!out.open(outPath, true)) {
+		return Common::Error(Common::kCreatingFileFailed, "Cannot open/create dump file " + outPath.toString(Common::Path::kNativeSeparator));
+	} else {
+		uint32 writtenBytes = out.write(data, len);
+		if (writtenBytes < len) {
+			// Not all data was written
+			out.close();
+			delete stream;
+			free(data);
+			return Common::Error(Common::kWritingFailed, "Not enough storage space! Please free up some storage and try again");
+		}
+		out.flush();
+		out.close();
+	}
+	free(data);
+
+	return Common::kNoError;
+}
+
 Common::Error Archive::dumpArchive(const Path &destPath) {
 	Common::ArchiveMemberList files;
 
 	listMembers(files);
 
-	byte *data = nullptr;
-	uint dataSize = 0;
-
 	for (auto &f : files) {
 		Common::Path filePath = f->getPathInArchive().punycodeEncode();
 		debug(1, "dumpArchive(): File: %s", filePath.toString().c_str());
@@ -140,36 +165,35 @@ Common::Error Archive::dumpArchive(const Path &destPath) {
 
 		Common::SeekableReadStream *stream = f->createReadStream();
 
-		uint32 len = stream->size();
-		if (dataSize < len) {
-			free(data);
-			data = (byte *)malloc(stream->size());
-			dataSize = stream->size();
+		if (stream) {
+			Common::Error err = dumpStream(stream, destPath, filePath, "");
+			delete stream;
+
+			if (err.getCode() != Common::kNoError)
+				return err;
 		}
 
-		stream->read(data, len);
-
-		Common::DumpFile out;
-		Common::Path outPath = destPath.join(filePath);
-		if (!out.open(outPath, true)) {
-			return Common::Error(Common::kCreatingFileFailed, "Cannot open/create dump file " + outPath.toString(Common::Path::kNativeSeparator));
-		} else {
-			uint32 writtenBytes = out.write(data, len);
-			if (writtenBytes < len) {
-				// Not all data was written
-				out.close();
-				delete stream;
-				free(data);
-				return Common::Error(Common::kWritingFailed, "Not enough storage space! Please free up some storage and try again");
-			}
-			out.flush();
-			out.close();
+		stream = f->createReadStreamForAltStream(Common::AltStreamType::MacFinderInfo);
+
+		if (stream) {
+			Common::Error err = dumpStream(stream, destPath, filePath, ".finfo");
+			delete stream;
+
+			if (err.getCode() != Common::kNoError)
+				return err;
 		}
 
-		delete stream;
+		stream = f->createReadStreamForAltStream(Common::AltStreamType::MacResourceFork);
+
+		if (stream) {
+			Common::Error err = dumpStream(stream, destPath, filePath, ".rsrc");
+			delete stream;
+
+			if (err.getCode() != Common::kNoError)
+				return err;
+		}
 	}
 
-	free(data);
 	return Common::kNoError;
 }
 




More information about the Scummvm-git-logs mailing list