From 9e8cb7bee889ebea1979d984c21b32db96b2917f Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Tue, 12 Nov 2024 20:10:25 +1100 Subject: [PATCH] Make ensure_directory() work with paths with no directory component --- common/common/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/common/__init__.py b/common/common/__init__.py index 40784e7..99a40a1 100644 --- a/common/common/__init__.py +++ b/common/common/__init__.py @@ -106,7 +106,8 @@ def ensure_directory(path): """Create directory that contains path, as well as any parent directories, if they don't already exist.""" dir_path = os.path.dirname(path) - os.makedirs(dir_path, exist_ok=True) + if dir_path != "": + os.makedirs(dir_path, exist_ok=True) def jitter(interval):