mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-05 12:18:21 +02:00
safe_eval now has mod_config in the environnement
This commit is contained in:
parent
cf0f61d8ee
commit
cb069fe240
2 changed files with 11 additions and 4 deletions
|
@ -44,4 +44,4 @@ class ExtractedGame:
|
||||||
# for all the subdirectory named "_PATCH", apply the patch
|
# for all the subdirectory named "_PATCH", apply the patch
|
||||||
for part_directory in mod_config.get_mod_directory().glob("[!_]*"):
|
for part_directory in mod_config.get_mod_directory().glob("[!_]*"):
|
||||||
for patch_directory in part_directory.glob("_PATCH/"):
|
for patch_directory in part_directory.glob("_PATCH/"):
|
||||||
yield from Patch(patch_directory).install(self)
|
yield from Patch(patch_directory, mod_config).install(self)
|
||||||
|
|
|
@ -9,8 +9,9 @@ class Patch:
|
||||||
Represent a patch object
|
Represent a patch object
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path: Path | str):
|
def __init__(self, path: Path | str, mod_config: "ModConfig"):
|
||||||
self.path = Path(path)
|
self.path = Path(path)
|
||||||
|
self.mod_config = mod_config
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"<{self.__class__.__name__} {self.path}>"
|
return f"<{self.__class__.__name__} {self.path}>"
|
||||||
|
@ -24,8 +25,14 @@ class Patch:
|
||||||
"""
|
"""
|
||||||
return safe_eval(
|
return safe_eval(
|
||||||
template,
|
template,
|
||||||
extra_token_map={"extracted_game": "extracted_game"},
|
extra_token_map={
|
||||||
env={"extracted_game": extracted_game},
|
"extracted_game": "extracted_game",
|
||||||
|
"mod_config": "mod_config"
|
||||||
|
},
|
||||||
|
env={
|
||||||
|
"extracted_game": extracted_game,
|
||||||
|
"mod_config": self.mod_config
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
def install(self, extracted_game: "ExtractedGame") -> Generator[dict, None, None]:
|
def install(self, extracted_game: "ExtractedGame") -> Generator[dict, None, None]:
|
||||||
|
|
Loading…
Reference in a new issue