Skip to content

Commit

Permalink
ulwgl_util: don't parse config twice
Browse files Browse the repository at this point in the history
- The root configuration file has already been read and abstracted as a Dictionary in the previous context, so just pass the reference
  • Loading branch information
R1kaB3rN committed Feb 28, 2024
1 parent 1cfa58a commit 4bd33d4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions ULWGL/ulwgl_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,9 @@ def force_rename(src: Path, dst: Path): # noqa: D103
src.rename(dst)


def setup_runtime(root: Path) -> None: # noqa: D103
# Open the JSON file and load its content into a Python dictionary
with root.joinpath(CONFIG).open(mode="r") as file:
data = load(file)

def setup_runtime(root: Path, json: Dict[str, Any]) -> None: # noqa: D103
# Access the 'runtime_platform' value
runtime_platform_value: str = data["ulwgl"]["versions"]["runtime_platform"]
runtime_platform_value: str = json["ulwgl"]["versions"]["runtime_platform"]

# Assuming runtime_platform_value is "sniper_platform_0.20240125.75305"
# Split the string at 'sniper_platform_'
Expand Down Expand Up @@ -232,7 +228,7 @@ def _install_ulwgl(
cp(root.joinpath("reaper"), local.joinpath("reaper"))

# Runtime platform
setup_runtime(root)
setup_runtime(root, json)

# Launcher files
for file in root.glob("*.py"):
Expand Down

0 comments on commit 4bd33d4

Please sign in to comment.