Merge pull request #615 from adamcik/feature/xdg_config_dirs

Add $XDG_CONFIG_DIRS to default config search path.
This commit is contained in:
Thomas Adamcik 2013-12-19 15:15:36 -08:00
commit 9a7f3a91ad
2 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,11 @@ a temporary regression of :issue:`527`.
asyncronously through the GObject event loop. This should resolve the issue
that has blocked the merge of the EOT-vs-EOS fix for a long time.
**Config file loading**
- The default for the config flag has been updated to include
``$XDG_CONFIG_DIRS`` in addition to ``$XDG_CONFIG_DIR``. (Fixes :issue:`431`)
v0.17.0 (2013-11-23)
====================

View File

@ -6,6 +6,7 @@ import logging
import os
import sys
import glib
import gobject
from mopidy import config as config_lib
@ -15,6 +16,11 @@ from mopidy.utils import deps, process, versioning
logger = logging.getLogger('mopidy.commands')
_default_config = []
for base in glib.get_system_config_dirs() + (glib.get_user_config_dir(),):
_default_config.append(os.path.join(base, b'mopidy', b'mopidy.conf'))
DEFAULT_CONFIG = b':'.join(_default_config)
def config_files_type(value):
return value.split(b':')
@ -243,7 +249,7 @@ class RootCommand(Command):
self.add_argument(
'--config',
action='store', dest='config_files', type=config_files_type,
default=b'$XDG_CONFIG_DIR/mopidy/mopidy.conf', metavar='FILES',
default=DEFAULT_CONFIG, metavar='FILES',
help='config files to use, colon seperated, later files override')
self.add_argument(
'-o', '--option',