Skip to content

Commit

Permalink
ensure file path exists
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jun 6, 2022
1 parent 3c7f706 commit dac7f48
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mycroft/skills/mycroft_skill/mycroft_skill.py
Expand Up @@ -20,8 +20,7 @@
from copy import copy
from inspect import signature
from itertools import chain
from os import walk, listdir
from os.path import join, abspath, dirname, basename, exists, isdir
from os.path import join, abspath, dirname, basename, exists, isfile
from threading import Event

from ovos_utils.intents import Intent, IntentBuilder
Expand Down Expand Up @@ -247,8 +246,12 @@ def _init_settings(self):
self._settings[k] = v
self._initial_settings = copy(self.settings)

self._settings_watchdog = FileWatcher([self._settings_path],
callback=self.settings_change_callback)
self._start_filewatcher()

def _start_filewatcher(self):
if self._settings_watchdog is None and isfile(self._settings.path):
self._settings_watchdog = FileWatcher([self._settings.path],
callback=self.settings_change_callback)

def _handle_settings_file_change(self):
if self._settings:
Expand Down Expand Up @@ -553,6 +556,7 @@ def handle_settings_change(self, message):
except:
self.log.exception("settings change callback failed, "
"remote changes not handled!")
self._start_filewatcher()

def detach(self):
for (name, _) in self.intent_service:
Expand Down

0 comments on commit dac7f48

Please sign in to comment.