flags: use $XDG_CONFIG_DIRS and $XDG_CONFIG_HOME as defaults
This does not add support for '$XDG_CONFIG_DIRS' expansion, it just makes the default include what it is set to.
This commit is contained in:
parent
147c304ee8
commit
89638e55d6
@ -6,6 +6,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import glib
|
||||||
import gobject
|
import gobject
|
||||||
|
|
||||||
from mopidy import config as config_lib
|
from mopidy import config as config_lib
|
||||||
@ -15,6 +16,12 @@ from mopidy.utils import deps, process, versioning
|
|||||||
|
|
||||||
logger = logging.getLogger('mopidy.commands')
|
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)
|
||||||
|
print DEFAULT_CONFIG
|
||||||
|
|
||||||
|
|
||||||
def config_files_type(value):
|
def config_files_type(value):
|
||||||
return value.split(b':')
|
return value.split(b':')
|
||||||
@ -243,7 +250,7 @@ class RootCommand(Command):
|
|||||||
self.add_argument(
|
self.add_argument(
|
||||||
'--config',
|
'--config',
|
||||||
action='store', dest='config_files', type=config_files_type,
|
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')
|
help='config files to use, colon seperated, later files override')
|
||||||
self.add_argument(
|
self.add_argument(
|
||||||
'-o', '--option',
|
'-o', '--option',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user