1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-28 10:46:15 +01:00

Merge branch 'xdg-config-home-fix' of https://github.com/hyperupcall/osc

Be a bit more compliant to the XDG base directory spec: "If
$XDG_CONFIG_HOME is either not set or empty, a default equal to
$HOME/.config should be used." [1].
Now, if the $XDG_CONFIG_HOME env variable is empty, we use the
default.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
This commit is contained in:
Marcus Huewe 2021-08-14 13:03:17 +02:00
commit 820f7ce7e5

View File

@ -1043,9 +1043,12 @@ def identify_conf():
if 'OSC_CONFIG' in os.environ:
return os.environ.get('OSC_CONFIG')
if os.path.exists(os.path.expanduser('~/.oscrc')):
conffile = '~/.oscrc'
return '~/.oscrc'
if os.environ.get('XDG_CONFIG_HOME', '') != '':
conffile = os.environ.get('XDG_CONFIG_HOME') + '/osc/oscrc'
else:
conffile = os.environ.get('XDG_CONFIG_HOME', '~/.config') + '/osc/oscrc'
conffile = '~/.config/osc/oscrc'
return conffile