Add support for XDG Base Directory Specification

fixes #219
master
flyingrub 2017-09-19 14:55:12 +02:00
parent f3a0436a2a
commit 964a1f46e7
1 changed files with 6 additions and 4 deletions

View File

@ -10,12 +10,14 @@ ALT_CLIENT_ID = '2t9loNQH90kzJcsFCODdigxfp325aq4z'
ALT2_CLIENT_ID = 'NONE'
dir_path_to_conf = os.path.join(os.path.expanduser('~'), '.config/scdl')
file_path_to_conf = os.path.join(
os.path.expanduser('~'), '.config/scdl/scdl.cfg'
)
if 'XDG_CONFIG_HOME' in os.environ:
dir_path_to_conf = os.environ['XDG_CONFIG_HOME']
file_path_to_conf = os.path.join(dir_path_to_conf, 'scdl.cfg')
text = """[scdl]
auth_token =
path = ."""
path = .
"""
if not os.path.exists(dir_path_to_conf):
os.makedirs(dir_path_to_conf)