1616import contextlib
1717import importlib
1818import json
19- import os
2019import re
2120import sys
2221import traceback
4241# happen at import time
4342WAIT_FOR_CLIENT : bool = False
4443
45- # A json list of paths to also to import mods from - you can add your repo to keep it separated
46- EXTRA_FOLDERS_ENV_VAR : str = "MOD_MANAGER_EXTRA_FOLDERS"
47-
4844
4945@dataclass
5046class ModInfo :
@@ -67,10 +63,10 @@ def init_debugpy() -> None:
6763 debugpy .wait_for_client () # pyright: ignore[reportUnknownMemberType] # noqa: T100
6864 debugpy .breakpoint () # pyright: ignore[reportUnknownMemberType] # noqa: T100
6965
70- if "PYUNREALSDK_DEBUGPY" not in os . environ :
66+ if not unrealsdk . config . get ( "pyunrealsdk" , {}). get ( "debugpy" , False ) :
7167 logging .dev_warning (
72- "Was able to start debugpy, but the `PYUNREALSDK_DEBUGPY` environment variable is"
73- " not set. This may prevent breakpoints from working properly." ,
68+ "Was able to start debugpy, but the `pyunrealsdk.debugpy` config variable is not "
69+ " set to true . This may prevent breakpoints from working properly." ,
7470 )
7571
7672 # Make WrappedArrays resolve the same as lists
@@ -94,15 +90,17 @@ def init_debugpy() -> None:
9490
9591def get_all_mod_folders () -> Sequence [Path ]:
9692 """
97- Gets all mod folders to try import from, including extra folders defined via env var .
93+ Gets all mod folders to try import from, including extra folders defined via config file .
9894
9995 Returns:
10096 A sequence of mod folder paths.
10197 """
10298
10399 extra_folders = []
104100 with contextlib .suppress (json .JSONDecodeError , TypeError ):
105- extra_folders = [Path (x ) for x in json .loads (os .environ .get (EXTRA_FOLDERS_ENV_VAR , "" ))]
101+ extra_folders = [
102+ Path (x ) for x in unrealsdk .config .get ("mod_manager" , {}).get ("extra_folders" , [])
103+ ]
106104
107105 return [Path (__file__ ).parent , * extra_folders ]
108106
@@ -335,24 +333,6 @@ def check_proton_bugs() -> None:
335333 "===============================================================================" ,
336334 )
337335
338- """
339- Env vars not propagating
340- ------------------------
341- We set various env vars in `unrealsdk.env`, which unrealsdk sets via `SetEnvironmentVariableA`.
342- On some proton versions this does not get propagated through to Python - despite clearly having
343- worked for pyunrealsdk, if we're able to run this script. Some of these are used by Python, and
344- may cause issues if we cannot find them.
345- """
346- if "PYUNREALSDK_INIT_SCRIPT" not in os .environ :
347- logging .error (
348- "===============================================================================\n "
349- "Some environment variables don't seem to have propagated into Python. This may\n "
350- "cause issues in parts of the mod manager or individual mods which expect them.\n "
351- "\n "
352- "Some particular Proton versions cause this, try switch to another one.\n "
353- "===============================================================================" ,
354- )
355-
356336
357337# Don't really want to put a `__name__` check here, since it's currently just `builtins`, and that
358338# seems a bit unstable, like something that pybind might eventually change
@@ -401,5 +381,3 @@ def check_proton_bugs() -> None:
401381
402382# After importing everything, register the base mod
403383register_base_mod ()
404-
405- del mod_folders , mods_to_import
0 commit comments