From 6619c29fb5a543b94be69c51f28984d7d77afc10 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Tue, 7 Feb 2023 21:21:15 +0000 Subject: [PATCH] Create parent dirs when adding cookies with auth add Fixes #21. --- devine/commands/auth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devine/commands/auth.py b/devine/commands/auth.py index c1870bb..2ec1544 100644 --- a/devine/commands/auth.py +++ b/devine/commands/auth.py @@ -237,7 +237,9 @@ def add(ctx: click.Context, profile: str, service: str, cookie: Optional[str] = log.info("Skipped adding a Credential...") if cookie: - cookie = cookie.rename((config.directories.cookies / service / profile).with_suffix(".txt")) + final_path = (config.directories.cookies / service / profile).with_suffix(".txt") + final_path.parent.mkdir(parents=True, exist_ok=True) + cookie = cookie.rename(final_path) log.info(f"Moved Cookie file to: {cookie}") if credential: