Skip to content

Commit 66cae54

Browse files
committed
Made sure to always unload plugins that are moved and only reload if destination is a python file
1 parent 93331b4 commit 66cae54

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

cloudbot/reloader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def unload(self, path):
5050
path = path.decode()
5151
self.bot.loop.call_soon_threadsafe(lambda: asyncio.async(self._unload(path), loop=self.bot.loop))
5252

53-
5453
@asyncio.coroutine
5554
def _reload(self, path):
5655
if path in self.reloading:
@@ -63,7 +62,6 @@ def _reload(self, path):
6362
self.reloading.remove(path)
6463
yield from self.bot.plugin_manager.load_plugin(path)
6564

66-
6765
@asyncio.coroutine
6866
def _unload(self, path):
6967
yield from self.bot.plugin_manager.unload_plugin(path)
@@ -87,6 +85,7 @@ def on_modified(self, event):
8785
self.loader.reload(event.src_path)
8886

8987
def on_moved(self, event):
88+
self.loader.unload(event.src_path)
9089
# only load if it's moved to a .py file
9190
if event.dest_path.endswith(".py" if isinstance(event.dest_path, str) else b".py"):
9291
self.loader.reload(event.dest_path)

0 commit comments

Comments
 (0)