Merge pull request #2723 from getpelican/fix-delete-output-logic

Fix output directory deletion logic
This commit is contained in:
Justin Mayer 2020-04-15 20:01:51 +02:00 committed by GitHub
commit 79095f7bd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,10 +99,11 @@ class Pelican(object):
) for cls in self.get_generator_classes()
]
# erase the directory if it is not the source and if that's
# explicitly asked
if (self.delete_outputdir and not
os.path.realpath(self.path).startswith(self.output_path)):
# Delete the output directory if (1) the appropriate setting is True
# and (2) that directory is not the parent of the source directory
if (self.delete_outputdir
and os.path.commonpath([self.output_path]) !=
os.path.commonpath([self.output_path, self.path])):
clean_output_dir(self.output_path, self.output_retention)
for p in generators: