mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 16:07:39 +00:00
DEVTOOLS: COMPANION: Fix mac mode and set file timestamps
This commit is contained in:
parent
23f6dc66ed
commit
8952db2dfd
@ -149,18 +149,25 @@ def collect_forks(args: argparse.Namespace) -> None:
|
|||||||
if has_resource_fork(dirpath, filename):
|
if has_resource_fork(dirpath, filename):
|
||||||
print(f"Resource in {filename}")
|
print(f"Resource in {filename}")
|
||||||
count_resources += 1
|
count_resources += 1
|
||||||
data_filename = filename
|
resource_filename = filename + "/..namedfork/rsrc"
|
||||||
to_filename = data_filename + ".bin"
|
to_filename = filename + ".bin"
|
||||||
if punify:
|
if punify:
|
||||||
tmp = punyencode(to_filename)
|
tmp = punyencode(to_filename)
|
||||||
if tmp != to_filename:
|
if tmp != to_filename:
|
||||||
print(f"Renamed {to_filename} to {tmp}")
|
print(f"Renamed {to_filename} to {tmp}")
|
||||||
count_renames += 1
|
count_renames += 1
|
||||||
to_filename = tmp
|
to_filename = tmp
|
||||||
with open(os.path.join(dirpath, filename), "rb") as rsrc:
|
|
||||||
file = machfs.File()
|
file = machfs.File()
|
||||||
|
|
||||||
|
# Set the file times and convert them to Mac epoch
|
||||||
|
info = os.stat(filename)
|
||||||
|
file.crdate = 2082844800 + int(info.st_birthtime)
|
||||||
|
file.mddate = 2082844800 + int(info.st_mtime)
|
||||||
|
|
||||||
|
with open(os.path.join(dirpath, resource_filename), "rb") as rsrc:
|
||||||
file.rsrc = rsrc.read()
|
file.rsrc = rsrc.read()
|
||||||
with open(os.path.join(dirpath, data_filename), "rb") as data:
|
with open(os.path.join(dirpath, filename), "rb") as data:
|
||||||
file.data = data.read()
|
file.data = data.read()
|
||||||
with open(os.path.join(dirpath, to_filename), "wb") as to_file:
|
with open(os.path.join(dirpath, to_filename), "wb") as to_file:
|
||||||
to_file.write(
|
to_file.write(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user