mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
create options files on WebHost startup
This commit is contained in:
17
WebHostLib/options.py
Normal file
17
WebHostLib/options.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
from Utils import __version__
|
||||
from jinja2 import Template
|
||||
import yaml
|
||||
|
||||
from worlds.AutoWorld import AutoWorldRegister
|
||||
|
||||
target_folder = os.path.join("WebHostLib", "static", "generated")
|
||||
|
||||
def create():
|
||||
for game_name, world in AutoWorldRegister.world_types.items():
|
||||
res = Template(open(os.path.join("WebHostLib", "templates", "options.yaml")).read()).render(
|
||||
options=world.options, __version__ = __version__, game=game_name, yaml_dump = yaml.dump
|
||||
)
|
||||
|
||||
with open(os.path.join(target_folder, game_name+".yaml"), "w") as f:
|
||||
f.write(res)
|
Reference in New Issue
Block a user