[Scummvm-git-logs] scummvm master -> 9ba6f1fe01117c349a9948c92e5b8769080292de

sev- sev at scummvm.org
Mon Aug 9 21:03:38 UTC 2021


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:
9ba6f1fe01 DEVTOOLS: COMPANION: Keep the file names in mac mode, set the modification time


Commit: 9ba6f1fe01117c349a9948c92e5b8769080292de
    https://github.com/scummvm/scummvm/commit/9ba6f1fe01117c349a9948c92e5b8769080292de
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-08-09T23:03:00+02:00

Commit Message:
DEVTOOLS: COMPANION: Keep the file names in mac mode, set the modification time

Changed paths:
    devtools/dumper-companion.py


diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index 90a541ec8f..f0cbbd117b 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -151,7 +151,7 @@ def collect_forks(args: argparse.Namespace) -> None:
                 print(f"Resource in {filename}")
                 count_resources += 1
                 resource_filename = filename + "/..namedfork/rsrc"
-                to_filename = filename + ".bin"
+                to_filename = filename
                 if punify:
                     tmp = punyencode(to_filename)
                     if tmp != to_filename:
@@ -172,8 +172,8 @@ def collect_forks(args: argparse.Namespace) -> None:
                 groups = re.search(r"type: \"(.*)\"\ncreator: \"(.*)\"", tmp)
 
                 # We may have here "\0\0\0\0"
-                file.type = eval("\"" + groups.group(1) + "\"").encode()
-                file.creator = eval("\"" + groups.group(2) + "\"").encode()
+                file.type = groups.group(1).encode().decode('unicode-escape').encode()
+                file.creator = groups.group(2).encode().decode('unicode-escape').encode()
 
                 with open(os.path.join(dirpath, resource_filename), "rb") as rsrc:
                     file.rsrc = rsrc.read()
@@ -183,6 +183,11 @@ def collect_forks(args: argparse.Namespace) -> None:
                     to_file.write(
                         file_to_macbin(file, to_filename, encoding="mac_roman")
                     )
+
+                    if to_filename != filename:
+                        os.remove(filename) # Remove the original file
+
+                    os.utime(os.path.join(dirpath, to_filename), (info.st_mtime, info.st_mtime))
             elif punify:
                 punified_filename = punyencode(filename)
                 if punified_filename != filename:




More information about the Scummvm-git-logs mailing list