diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/src/main.py | 2 | ||||
| -rw-r--r-- | backend/src/plugin/sandboxed_plugin.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/backend/src/main.py b/backend/src/main.py index ef090df4..86c4720d 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -181,7 +181,7 @@ def main(): logger.warning(f"decky is running as an unprivileged user, this is not officially supported and may cause issues") # Append the loader's plugin path to the recognized python paths - sys.path.append(path.join(path.dirname(__file__), "plugin")) + sys.path.append(path.join(path.dirname(__file__), "..", "plugin")) # Append the system and user python paths sys.path.extend(get_system_pythonpaths()) diff --git a/backend/src/plugin/sandboxed_plugin.py b/backend/src/plugin/sandboxed_plugin.py index d44794fa..adf9f802 100644 --- a/backend/src/plugin/sandboxed_plugin.py +++ b/backend/src/plugin/sandboxed_plugin.py @@ -3,7 +3,7 @@ from signal import SIGINT, signal from importlib.util import module_from_spec, spec_from_file_location from json import dumps, loads from logging import getLogger -from sys import exit, path as syspath +from sys import exit, path as syspath, modules as sysmodules from traceback import format_exc from asyncio import (get_event_loop, new_event_loop, set_event_loop, sleep) @@ -72,6 +72,11 @@ class SandboxedPlugin: # append the plugin's `py_modules` to the recognized python paths syspath.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules")) + + #TODO: FIX IN A LESS CURSED WAY + keys = [key.replace("src.", "") for key in sysmodules if key.startswith("src.")] + for key in keys: + sysmodules[key] = sysmodules["src"].__dict__[key] spec = spec_from_file_location("_", self.file) assert spec is not None |
