From 62a2e31ce26094d47f115f913b362bf9576d32eb Mon Sep 17 00:00:00 2001 From: Faraphel Date: Sun, 24 Jul 2022 17:38:55 +0200 Subject: [PATCH] fixed safe_eval for PatchFile. Now condition need to be exactly True instead of everything but False --- source/mkw/Patch/PatchDirectory.py | 2 +- source/mkw/Patch/PatchFile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/mkw/Patch/PatchDirectory.py b/source/mkw/Patch/PatchDirectory.py index 1ce1bba..1717f2f 100644 --- a/source/mkw/Patch/PatchDirectory.py +++ b/source/mkw/Patch/PatchDirectory.py @@ -24,7 +24,7 @@ class PatchDirectory(PatchObject): """ yield {"description": f"Patching {self}"} - if self.patch.safe_eval(self.configuration["if"], {"extracted_game": extracted_game}) == "False": return + if self.patch.safe_eval(self.configuration["if"], env={"extracted_game": extracted_game}) != "True": return match self.configuration["mode"]: # if the mode is copy, then simply patch the subfile into the game with the same path diff --git a/source/mkw/Patch/PatchFile.py b/source/mkw/Patch/PatchFile.py index da85130..e071c40 100644 --- a/source/mkw/Patch/PatchFile.py +++ b/source/mkw/Patch/PatchFile.py @@ -31,7 +31,7 @@ class PatchFile(PatchObject): yield {"description": f"Patching {self}"} # check if the file should be patched considering the "if" configuration - if self.patch.safe_eval(self.configuration["if"], {"extracted_game": extracted_game}) == "False": return + if self.patch.safe_eval(self.configuration["if"], env={"extracted_game": extracted_game}) != "True": return # check if the path to the game_subpath is inside a szs, and if yes extract it for szs_subpath in filter(lambda path: path.suffix == ".d",