fix(hotreload): verify that a file path exists before creating an observer schedule for it
This commit is contained in:
parent
70d75c688c
commit
5c6783452d
1 changed files with 5 additions and 1 deletions
|
@ -19,7 +19,7 @@ class HotReload(commands.Cog):
|
|||
|
||||
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||
__version__ = "1.3.1"
|
||||
__version__ = "1.3.2"
|
||||
__documentation__ = "https://seacogs.coastalcommits.com/hotreload/"
|
||||
|
||||
def __init__(self, bot: Red) -> None:
|
||||
|
@ -73,6 +73,10 @@ class HotReload(commands.Cog):
|
|||
self.logger.debug("Stopped hanging observer.")
|
||||
continue
|
||||
for path in paths:
|
||||
if not path.exists():
|
||||
self.logger.warning("Path %s does not exist. Skipping.", path)
|
||||
continue
|
||||
self.logger.debug("Adding observer schedule for path %s.", path)
|
||||
observer.schedule(event_handler=HotReloadHandler(cog=self, path=path), path=path, recursive=True)
|
||||
observer.start()
|
||||
self.logger.info("Started observer. Watching for file changes.")
|
||||
|
|
Loading…
Add table
Reference in a new issue