Skip to content

Commit

Permalink
Make directory for post rendered files
Browse files Browse the repository at this point in the history
  • Loading branch information
percyfal committed Nov 14, 2023
1 parent fa00d3d commit 88a0283
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/post-render.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
import shutil


def safe_mkdir(dirname):
logging.debug(f"Making directory {dirname}")
if not os.path.exists(dirname):
try:
os.mkdir(dirname)
except FileNotFoundError as e:
print(e)
raise


def safe_copy(src, dst):
logging.debug(f"Copy {dst} -> {src}")
if not os.path.exists(src):
Expand Down Expand Up @@ -38,4 +48,6 @@ def safe_copy(src, dst):
for fn in files:
src = os.path.join(qpd, fn)
dst = os.path.join(SITE_DIR, fn)
dirname = os.path.dirname(dst)
safe_mkdir(dirname)
safe_copy(src, dst)

0 comments on commit 88a0283

Please sign in to comment.