Use cross platform paths (#237)
# PR Description Tiny PR to use `os.path.join` instead of hardcoding paths with forward slashes.
This commit is contained in:
parent
aaf1dbd795
commit
a344cc0a8b
1 changed files with 4 additions and 3 deletions
|
|
@ -58,11 +58,12 @@ class LoginCallbackHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# ensure the ~/.arcade directory exists
|
# ensure the ~/.arcade directory exists
|
||||||
# TODO: this should use WORK_DIR from env if set
|
# TODO: this should use WORK_DIR from env if set
|
||||||
if not os.path.exists(os.path.expanduser("~/.arcade")):
|
arcade_dir = os.path.join(os.path.expanduser("~"), ".arcade")
|
||||||
os.makedirs(os.path.expanduser("~/.arcade"), exist_ok=True)
|
if not os.path.exists(arcade_dir):
|
||||||
|
os.makedirs(arcade_dir, exist_ok=True)
|
||||||
|
|
||||||
# TODO don't overwrite existing config
|
# TODO don't overwrite existing config
|
||||||
config_file_path = os.path.expanduser("~/.arcade/credentials.yaml")
|
config_file_path = os.path.join(arcade_dir, "credentials.yaml")
|
||||||
new_config = {"cloud": {"api": {"key": api_key}, "user": {"email": email}}}
|
new_config = {"cloud": {"api": {"key": api_key}, "user": {"email": email}}}
|
||||||
with open(config_file_path, "w") as f:
|
with open(config_file_path, "w") as f:
|
||||||
yaml.dump(new_config, f)
|
yaml.dump(new_config, f)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue