added seek(0) before writing a PatchFile

This commit is contained in:
Faraphel 2022-07-15 20:25:04 +02:00
parent 7463e9f10b
commit 04268a17a1

View file

@ -65,6 +65,7 @@ class PatchFile(PatchObject):
game_subpath.parent.mkdir(parents=True, exist_ok=True) game_subpath.parent.mkdir(parents=True, exist_ok=True)
with open(game_subpath.parent / patch_name, "wb") as file: with open(game_subpath.parent / patch_name, "wb") as file:
patch_content.seek(0)
file.write(patch_content.read()) file.write(patch_content.read())
# if the mode is match, replace all the subfiles that match match_regex by the PatchFile # if the mode is match, replace all the subfiles that match match_regex by the PatchFile
@ -78,6 +79,7 @@ class PatchFile(PatchObject):
game_subfile.parent.mkdir(parents=True, exist_ok=True) game_subfile.parent.mkdir(parents=True, exist_ok=True)
with open(game_subfile, "wb") as file: with open(game_subfile, "wb") as file:
patch_content.seek(0)
file.write(patch_content.read()) file.write(patch_content.read())
# ignore if mode is "ignore", useful if the file is used as a resource for an operation # ignore if mode is "ignore", useful if the file is used as a resource for an operation