Commit 62449f55 authored by Kiste's avatar Kiste
Browse files

Catch non existing environment variable

parent de7c4e4f
......@@ -23,10 +23,12 @@ def main():
else:
print('Die Konfigurationsdatei "' + args.config + '" existiert nicht!')
exit(1)
elif os.path.isfile(os.environ['XDG_CONFIG_HOME'] + '/studsauger/config.yaml'):
configpath = os.environ['XDG_CONFIG_HOME'] + '/studsauger/config.yaml'
elif os.path.isfile(os.environ['HOME'] + '/.config/studsauger/config.yaml'):
configpath = os.environ['HOME'] + '/.config/studsauger/config.yaml'
elif 'XDG_CONFIG_HOME' in os.environ:
if os.path.isfile(os.environ['XDG_CONFIG_HOME'] + '/studsauger/config.yaml'):
configpath = os.environ['XDG_CONFIG_HOME'] + '/studsauger/config.yaml'
elif 'HOME' in os.environ:
if os.path.isfile(os.environ['HOME'] + '/.config/studsauger/config.yaml'):
configpath = os.environ['HOME'] + '/.config/studsauger/config.yaml'
if configpath:
with open(configpath, 'r') as stream:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment