forked from DRMTalks/devine
Check if Cookie file for profile already exists during auth add
Fixes #16.
This commit is contained in:
parent
6619c29fb5
commit
c5d6ba09f2
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
import tkinter.filedialog
|
import tkinter.filedialog
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -239,6 +240,9 @@ def add(ctx: click.Context, profile: str, service: str, cookie: Optional[str] =
|
||||||
if cookie:
|
if cookie:
|
||||||
final_path = (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)
|
final_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if final_path.exists():
|
||||||
|
log.error(f"A Cookie file for the Profile {profile} on {service} already exists.")
|
||||||
|
sys.exit(1)
|
||||||
cookie = cookie.rename(final_path)
|
cookie = cookie.rename(final_path)
|
||||||
log.info(f"Moved Cookie file to: {cookie}")
|
log.info(f"Moved Cookie file to: {cookie}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue