fix: live preview rebuilds no longer crash the server
When cleaning the previous build, we deleted the entire directory, which caused problems. Now, we only clean the output dir's children, but leave the dir itself intact.
This commit is contained in:
parent
8d17572d12
commit
dacea2756a
1 changed files with 7 additions and 1 deletions
|
@ -145,7 +145,13 @@ class ZonaBuilder:
|
|||
and self.layout.output.is_dir()
|
||||
):
|
||||
logger.debug("Removing stale output...")
|
||||
shutil.rmtree(self.layout.output)
|
||||
# only remove output dir's children
|
||||
# to avoid breaking live preview
|
||||
for child in self.layout.output.iterdir():
|
||||
if child.is_file() or child.is_symlink():
|
||||
child.unlink()
|
||||
elif child.is_dir():
|
||||
shutil.rmtree(child)
|
||||
logger.debug("Discovering...")
|
||||
self._discover()
|
||||
logger.debug("Building...")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue