Skip to content

Commit 852928b

Browse files
committed
smol fix: use cm for reading moni file
1 parent 2151b13 commit 852928b

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

‎Monika After Story/game/zz_dockingstation.rpy‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,9 +1288,7 @@ init 200 python in mas_dockstat:
12881288
return True
12891289

12901290
except Exception as e:
1291-
log.write(
1292-
"[ERROR]: failed to pickle data: {0}".format(repr(e))
1293-
)
1291+
log.write(f"[ERROR]: failed to pickle data: {e!r}")
12941292
return False
12951293

12961294

@@ -1481,14 +1479,13 @@ init 200 python in mas_dockstat:
14811479
_buildMetaDataList(moni_buffer)
14821480

14831481
### monikachr
1484-
moni_chr = None
14851482
try:
1486-
moni_chr = open(os.path.normcase(
1487-
renpy.config.basedir + "/game/mod_assets/monika/mbase"
1488-
), "rb")
1489-
1490-
# NOTE: moin_chr is going to be less than 200KB, this be fine
1491-
moni_buffer.write(moni_chr.read().decode("utf-8"))
1483+
with open(
1484+
os.path.normcase(renpy.config.basedir + "/game/mod_assets/monika/mbase"),
1485+
"rb",
1486+
) as moni_chr:
1487+
# NOTE: moin_chr is going to be less than 200KB, this be fine
1488+
moni_buffer.write(moni_chr.read().decode("utf-8"))
14921489

14931490
except Exception as e:
14941491
cr_log.error("mbase copy failed | {0}".format(
@@ -1497,11 +1494,6 @@ init 200 python in mas_dockstat:
14971494
moni_buffer.close()
14981495
return False
14991496

1500-
finally:
1501-
# always close moni_chr
1502-
if moni_chr is not None:
1503-
moni_chr.close()
1504-
15051497
### now we must do the streamlined write system to file
15061498
moni_path = dockstat._trackPackage("monika")
15071499
moni_fbuffer = None

0 commit comments

Comments
 (0)