Skip to content

Commit

Permalink
Fixed touch when parent dir does not exist
Browse files Browse the repository at this point in the history
Signed-off-by: Ole Herman Schumacher Elgesem <[email protected]>
  • Loading branch information
olehermanse committed Apr 26, 2021
1 parent 64046e0 commit 286a84e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cfbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def mkdir(path: str):


def touch(path: str):
if "/" in path:
above = os.path.dirname(path)
if not os.path.exists(above):
mkdir(above)
sh(f"touch {path}")


Expand Down

0 comments on commit 286a84e

Please sign in to comment.