mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #530: FILES_TO_COPY error when dest dir missing
If the destination directory specified by FILES_TO_COPY does not exist, site generation crashes with a CRITICAL error. This creates the destination if it does not exist.
This commit is contained in:
parent
52ce7983e4
commit
01293dedaa
1 changed files with 6 additions and 0 deletions
|
|
@ -90,6 +90,12 @@ def copy(path, source, destination, destination_path=None, overwrite=False):
|
|||
logger.info('replacement of %s with %s' % (source_, destination_))
|
||||
|
||||
elif os.path.isfile(source_):
|
||||
try:
|
||||
dest_dir = os.path.dirname(destination_)
|
||||
if not os.path.exists(dest_dir):
|
||||
os.makedirs(dest_dir)
|
||||
except OSError, e:
|
||||
logger.error("copying: %s -> %s: %r" % (source_, dest_dir, e))
|
||||
shutil.copy(source_, destination_)
|
||||
logger.info('copying %s to %s' % (source_, destination_))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue