Make ensure_directory() work with paths with no directory component

pull/484/head
Mike Lang 3 days ago
parent 854b5723bb
commit 9e8cb7bee8

@ -106,6 +106,7 @@ def ensure_directory(path):
"""Create directory that contains path, as well as any parent directories, """Create directory that contains path, as well as any parent directories,
if they don't already exist.""" if they don't already exist."""
dir_path = os.path.dirname(path) dir_path = os.path.dirname(path)
if dir_path != "":
os.makedirs(dir_path, exist_ok=True) os.makedirs(dir_path, exist_ok=True)

Loading…
Cancel
Save