OAuth config file improvements

This commit is contained in:
Théo Piboubès
2015-08-31 20:37:02 +02:00
parent 3fb4dc66bb
commit 314d2dbf26
2 changed files with 10 additions and 19 deletions

View File

@@ -76,17 +76,12 @@ class OAuthTool(object):
XDG_CONFIG_HOME = os.getenv('XDG_CONFIG_HOME',
os.path.join(HOME, '.config'))
config_paths = [
os.path.join(XDG_CONFIG_HOME, 'rtv', 'oauth.cfg'),
os.path.join(HOME, '.rtv-oauth')
]
if os.path.exists(os.path.join(XDG_CONFIG_HOME, 'rtv')):
file_path = os.path.join(XDG_CONFIG_HOME, 'rtv', 'oauth.cfg')
else:
file_path = os.path.join(HOME, '.rtv-oauth')
# get the first existing config file
for config_path in config_paths:
if os.path.exists(config_path):
break
return config_path
return file_path
def open_config(self, update=False):
if self.config_fp is None: