mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
don't watch not existing paths
This commit is contained in:
parent
631ac1bdb3
commit
b289dcea82
1 changed files with 9 additions and 5 deletions
|
|
@ -764,21 +764,25 @@ def wait_for_changes(settings_file, reader_class, settings):
|
||||||
fnmatch.translate(pattern) for pattern in settings.get('IGNORE_FILES', [])
|
fnmatch.translate(pattern) for pattern in settings.get('IGNORE_FILES', [])
|
||||||
)
|
)
|
||||||
|
|
||||||
watching_paths = [
|
candidate_paths = [
|
||||||
settings_file,
|
settings_file,
|
||||||
theme_path,
|
theme_path,
|
||||||
content_path,
|
content_path,
|
||||||
]
|
]
|
||||||
|
|
||||||
watching_paths.extend(
|
candidate_paths.extend(
|
||||||
os.path.join(content_path, path) for path in settings.get('STATIC_PATHS', [])
|
os.path.join(content_path, path) for path in settings.get('STATIC_PATHS', [])
|
||||||
)
|
)
|
||||||
|
|
||||||
watching_paths = [os.path.abspath(p) for p in watching_paths if p]
|
watching_paths = []
|
||||||
|
for path in candidate_paths:
|
||||||
for path in watching_paths:
|
if not path:
|
||||||
|
continue
|
||||||
|
path = os.path.abspath(path)
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
logger.warning("Unable to watch path '%s' as it does not exist.", path)
|
logger.warning("Unable to watch path '%s' as it does not exist.", path)
|
||||||
|
else:
|
||||||
|
watching_paths.append(path)
|
||||||
|
|
||||||
return next(watchfiles.watch(
|
return next(watchfiles.watch(
|
||||||
*watching_paths,
|
*watching_paths,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue