Skip to content

Commit f364583

Browse files
Stephen0512K0lb3
authored andcommitted
explicitly close file
1 parent cc41c4d commit f364583

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

UnityPy/helpers/TypeTreeGenerator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def load_local_game(self, root_dir: str):
3030
if "GameAssembly.dll" in root_files:
3131
ga_fp = os.path.join(root_dir, "GameAssembly.dll")
3232
gm_fp = os.path.join(data_dir, "il2cpp_data", "Metadata", "global-metadata.dat")
33-
ga_raw = open(ga_fp, "rb").read()
34-
gm_raw = open(gm_fp, "rb").read()
33+
with open(ga_fp, "rb") as f:
34+
ga_raw = f.read()
35+
with open(gm_fp, "rb") as f:
36+
gm_raw = f.read()
3537
self.load_il2cpp(ga_raw, gm_raw)
3638
else:
3739
self.load_local_dll_folder(os.path.join(data_dir, "Managed"))

0 commit comments

Comments
 (0)