Skip to content

Commit

Permalink
scripts/mkdoc.py: add missing guard for filepath being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
climbfuji committed Oct 10, 2019
1 parent 5a67e43 commit e742528
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/mkdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# and use this for ccpp_prebuild.py; create to_html and to_latex routines for it

import logging
import os

from common import decode_container, escape_tex

Expand Down Expand Up @@ -65,6 +66,9 @@ def metadata_to_html(metadata, model, filename):
</html>
'''

filepath = os.path.split(os.path.abspath(filename))[0]
if not os.path.isdir(filepath):
os.makedirs(filepath)
with open(filename, 'w') as f:
f.write(html)

Expand Down Expand Up @@ -167,6 +171,9 @@ def metadata_to_latex(metadata_define, metadata_request, pset_request, model, fi
\\end{document}
'''

filepath = os.path.split(os.path.abspath(filename))[0]
if not os.path.isdir(filepath):
os.makedirs(filepath)
with open(filename, 'w') as f:
f.write(latex)

Expand Down

0 comments on commit e742528

Please sign in to comment.