16
16
import contextlib
17
17
import importlib
18
18
import json
19
- import os
20
19
import re
21
20
import sys
22
21
import traceback
42
41
# happen at import time
43
42
WAIT_FOR_CLIENT : bool = False
44
43
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
-
48
44
49
45
@dataclass
50
46
class ModInfo :
@@ -67,10 +63,10 @@ def init_debugpy() -> None:
67
63
debugpy .wait_for_client () # pyright: ignore[reportUnknownMemberType] # noqa: T100
68
64
debugpy .breakpoint () # pyright: ignore[reportUnknownMemberType] # noqa: T100
69
65
70
- if "PYUNREALSDK_DEBUGPY" not in os . environ :
66
+ if not unrealsdk . config . get ( "pyunrealsdk" , {}). get ( "debugpy" , False ) :
71
67
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." ,
74
70
)
75
71
76
72
# Make WrappedArrays resolve the same as lists
@@ -94,15 +90,17 @@ def init_debugpy() -> None:
94
90
95
91
def get_all_mod_folders () -> Sequence [Path ]:
96
92
"""
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 .
98
94
99
95
Returns:
100
96
A sequence of mod folder paths.
101
97
"""
102
98
103
99
extra_folders = []
104
100
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
+ ]
106
104
107
105
return [Path (__file__ ).parent , * extra_folders ]
108
106
@@ -335,24 +333,6 @@ def check_proton_bugs() -> None:
335
333
"===============================================================================" ,
336
334
)
337
335
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
-
356
336
357
337
# Don't really want to put a `__name__` check here, since it's currently just `builtins`, and that
358
338
# seems a bit unstable, like something that pybind might eventually change
@@ -401,5 +381,3 @@ def check_proton_bugs() -> None:
401
381
402
382
# After importing everything, register the base mod
403
383
register_base_mod ()
404
-
405
- del mod_folders , mods_to_import
0 commit comments