summaryrefslogtreecommitdiff
path: root/backend/loader.py
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-09-18 14:49:32 -0400
committerAAGaming <aa@mail.catvibers.me>2022-09-18 14:49:32 -0400
commit7716c73014a645d3742c24eaa7c7b1d54e081363 (patch)
tree89120cabfb6b1dca621fa7e319c278a499169acf /backend/loader.py
parent8829adc5b6361cc7ab972ea2f43ab07db206dc93 (diff)
downloaddecky-loader-7716c73014a645d3742c24eaa7c7b1d54e081363.tar.gz
decky-loader-7716c73014a645d3742c24eaa7c7b1d54e081363.zip
fix plugin loading after install, move updater reloads to loader
Diffstat (limited to 'backend/loader.py')
-rw-r--r--backend/loader.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/backend/loader.py b/backend/loader.py
index 9c2b33f4..b4d81368 100644
--- a/backend/loader.py
+++ b/backend/loader.py
@@ -25,8 +25,11 @@ class FileChangeHandler(RegexMatchingEventHandler):
self.logger = getLogger("file-watcher")
self.plugin_path = plugin_path
self.queue = queue
+ self.disabled = False
def maybe_reload(self, src_path):
+ if self.disabled:
+ return
plugin_dir = Path(path.relpath(src_path, self.plugin_path)).parts[0]
if exists(path.join(self.plugin_path, plugin_dir, "plugin.json")):
self.queue.put_nowait((path.join(self.plugin_path, plugin_dir, "main.py"), plugin_dir, True))
@@ -66,11 +69,13 @@ class Loader:
self.plugin_path = plugin_path
self.logger.info(f"plugin_path: {self.plugin_path}")
self.plugins = {}
+ self.watcher = None
if live_reload:
self.reload_queue = Queue()
self.observer = Observer()
- self.observer.schedule(FileChangeHandler(self.reload_queue, plugin_path), self.plugin_path, recursive=True)
+ self.watcher = FileChangeHandler(self.reload_queue, plugin_path)
+ self.observer.schedule(self.watcher, self.plugin_path, recursive=True)
self.observer.start()
self.loop.create_task(self.handle_reloads())