Skip to content

Commit

Permalink
fix: create parent path if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Oct 1, 2019
1 parent c5e6246 commit 3894fa6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import os
import pkg_resources
import shutil
from pathlib import Path

from sphinx.util import logging

Expand Down Expand Up @@ -82,11 +83,13 @@
def copy_static_html_pages(app, exception):
if exception is None and app.builder.name == 'html':
for static_html_page in static_html_pages:
target_path = app.outdir + '/' + static_html_page
src_path = app.srcdir + '/' + static_html_page
target_path = Path(app.outdir + '/' + static_html_page)
src_path = Path(app.srcdir + '/' + static_html_page)
if os.path.isfile(src_path):
logger.info(
'Copying static html: %s -> %s', src_path, target_path)
if not target_path.parent.exists():
target_path.parent.mkdir(parents=True)
shutil.copyfile(src_path, target_path)

def setup(app):
Expand Down

0 comments on commit 3894fa6

Please sign in to comment.