[Scummvm-git-logs] scummvm master -> e2928dfb1a8742f4c6d874047695002c9f2aaf18
rvanlaar
noreply at scummvm.org
Sun Feb 12 11:03:11 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
848c7fa296 DEVTOOLS: COMPANION: Fix bug with absolute paths as the output directory
479510bac1 DEVTOOLS: COMPANION: print path when doing --dryrun
e2928dfb1a DEVTOOLS: COMPANION: formatting cleanup
Commit: 848c7fa2969614bbcfd22bec8042d4957b06ba7d
https://github.com/scummvm/scummvm/commit/848c7fa2969614bbcfd22bec8042d4957b06ba7d
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2023-02-12T12:03:05+01:00
Commit Message:
DEVTOOLS: COMPANION: Fix bug with absolute paths as the output directory
The script would start trying to set the last-modified date for each
part of the output directory path (e.g. /home/). The previous code was
getting too complex so just do a simpler method.
Changed paths:
devtools/dumper-companion.py
diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index 59c84122922..4ae1788d797 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -339,6 +339,7 @@ def extract_volume(args: argparse.Namespace) -> int:
destination_dir.mkdir(parents=True, exist_ok=True)
might_be_jp = False
might_be_jp_warned = False
+ folders = []
for hpath, obj in vol.iter_paths():
# Encode the path
upath = destination_dir
@@ -371,8 +372,8 @@ def extract_volume(args: argparse.Namespace) -> int:
# Write the file to disk
if isinstance(obj, machfs.Folder):
upath.mkdir(exist_ok=True)
- os.utime(upath, (obj.mddate - 2082844800, obj.mddate - 2082844800))
- # Set the modified time for folders
+ # Save the modified time for folders to apply once all files are written
+ folders.append((upath, obj.mddate - 2082844800))
continue
print(upath)
@@ -387,15 +388,13 @@ def extract_volume(args: argparse.Namespace) -> int:
upath.touch()
os.utime(upath, (obj.mddate - 2082844800, obj.mddate - 2082844800))
- # This needs to be done after writing files as writing files resets
- # the parent folder's modified time that was set before
- if len(hpath) > 1:
- for i in range(len(hpath), 0, -1):
- parent_folder_modtime = vol.get(hpath[:i]).mddate - 2082844800
- os.utime(
- Path(*(upath.parts[:i])),
- (parent_folder_modtime, parent_folder_modtime),
- )
+
+ # This needs to be done after writing files as writing files resets
+ # the parent folder's modified time
+ if not dryrun:
+ for upath, modtime in folders:
+ os.utime(upath, (modtime, modtime))
+
return 0
Commit: 479510bac159ad7b10a9176cd78683fc20110184
https://github.com/scummvm/scummvm/commit/479510bac159ad7b10a9176cd78683fc20110184
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2023-02-12T12:03:05+01:00
Commit Message:
DEVTOOLS: COMPANION: print path when doing --dryrun
Changed paths:
devtools/dumper-companion.py
diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index 4ae1788d797..e277457fb14 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -367,6 +367,9 @@ def extract_volume(args: argparse.Namespace) -> int:
might_be_jp_warned = True
if dryrun:
+ if not isinstance(obj, machfs.Folder):
+ print(upath)
+
continue
# Write the file to disk
Commit: e2928dfb1a8742f4c6d874047695002c9f2aaf18
https://github.com/scummvm/scummvm/commit/e2928dfb1a8742f4c6d874047695002c9f2aaf18
Author: eientei (einstein95 at users.noreply.github.com)
Date: 2023-02-12T12:03:05+01:00
Commit Message:
DEVTOOLS: COMPANION: formatting cleanup
Changed paths:
devtools/dumper-companion.py
diff --git a/devtools/dumper-companion.py b/devtools/dumper-companion.py
index e277457fb14..995c19146b8 100755
--- a/devtools/dumper-companion.py
+++ b/devtools/dumper-companion.py
@@ -312,7 +312,7 @@ def extract_volume(args: argparse.Namespace) -> int:
vol = machfs.Volume()
with source_volume.open(mode="rb") as f:
f.seek(0x200)
- if f.read(4) == b"PM\0\0":
+ if f.read(4) == b"PM\x00\x00":
partition_num = 1
partition_type = ""
while partition_type != "Apple_HFS":
@@ -320,7 +320,7 @@ def extract_volume(args: argparse.Namespace) -> int:
">III", f.read(12)
)
f.seek(32, 1)
- partition_type = f.read(32).decode("ascii").split("\0")[0]
+ partition_type = f.read(32).decode("ascii").split("\x00")[0]
if partition_num <= num_partitions and partition_type != "Apple_HFS":
# Move onto the next partition
partition_num += 1
@@ -328,7 +328,6 @@ def extract_volume(args: argparse.Namespace) -> int:
else:
# We found the one we want or there's none
break
-
f.seek(partition_start * 0x200)
vol.read(f.read(partition_size * 0x200))
else:
@@ -337,6 +336,7 @@ def extract_volume(args: argparse.Namespace) -> int:
if not dryrun:
destination_dir.mkdir(parents=True, exist_ok=True)
+
might_be_jp = False
might_be_jp_warned = False
folders = []
@@ -369,7 +369,6 @@ def extract_volume(args: argparse.Namespace) -> int:
if dryrun:
if not isinstance(obj, machfs.Folder):
print(upath)
-
continue
# Write the file to disk
@@ -460,7 +459,7 @@ def punyencode_arg(args: argparse.Namespace) -> int:
def punyencode_dir(
- directory: Path, verbose: bool = False, source_encoding: str|None = None
+ directory: Path, verbose: bool = False, source_encoding: str | None = None
) -> int:
"""
Recursively punyencode all directory and filenames
More information about the Scummvm-git-logs
mailing list