Skip to content

Commit

Permalink
ensure subdir exists before putting a softlink in it
Browse files Browse the repository at this point in the history
  • Loading branch information
russHyde committed Mar 7, 2019
1 parent 683b6ef commit 13f1e92
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

def setup_links(parent_dir, required_links):
for link_name in required_links:
try:
dname = os.path.dirname(link_name)
os.makedirs(dname, exist_ok=True)
except FileNotFoundError:
pass
except Exception:
raise
subprocess.run(
["ln", "-rs", os.path.join(parent_dir, link_name), link_name]
)
Expand Down

0 comments on commit 13f1e92

Please sign in to comment.