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

sev- noreply at scummvm.org
Wed Jul 19 20:22:42 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:
ca7e41c4e0 COMMON: Use getPathInArchive() and Path::punycodeEncode() in dumpArchive() and fix directory issue


Commit: ca7e41c4e0bf2d7c41c96fb8717e59dbc52b6834
    https://github.com/scummvm/scummvm/commit/ca7e41c4e0bf2d7c41c96fb8717e59dbc52b6834
Author: Ankush Dutt (ankushd100 at gmail.com)
Date: 2023-07-19T22:22:38+02:00

Commit Message:
COMMON: Use getPathInArchive() and Path::punycodeEncode() in dumpArchive() and fix directory issue

This commit will fix:
- The dumped games using dumpArchive() are not detected.
- The archive's contents were being dumped one directory back the destPath

Changed paths:
    common/archive.cpp


diff --git a/common/archive.cpp b/common/archive.cpp
index e455e344d01..227ca060ca0 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -26,6 +26,7 @@
 #include "common/textconsole.h"
 #include "common/memstream.h"
 #include "common/punycode.h"
+#include "common/debug.h"
 
 namespace Common {
 
@@ -88,9 +89,8 @@ void Archive::dumpArchive(String destPath) {
 	uint dataSize = 0;
 
 	for (auto &f : files) {
-		Common::String filename = Common::punycode_encodefilename(f->getName());
-		warning("File: %s", filename.c_str());
-
+		Common::Path filePath = f->getPathInArchive().punycodeEncode();
+		debug(1, "File: %s", filePath.toString().c_str());
 		Common::SeekableReadStream *stream = f->createReadStream();
 
 		uint32 len = stream->size();
@@ -103,9 +103,9 @@ void Archive::dumpArchive(String destPath) {
 		stream->read(data, len);
 
 		Common::DumpFile out;
-		Common::String outname = destPath + filename;
-		if (!out.open(outname, true)) {
-			warning("Archive::dumpArchive(): Can not open dump file %s", outname.c_str());
+		Common::Path outPath = Common::Path(destPath).join(filePath);
+		if (!out.open(outPath.toString(), true)) {
+			warning("Archive::dumpArchive(): Can not open dump file %s", outPath.toString().c_str());
 		} else {
 			out.write(data, len);
 			out.flush();




More information about the Scummvm-git-logs mailing list