path: Use our expand_path instead of os.path.expanduser

This commit is contained in:
Stein Magnus Jodal 2013-04-09 00:09:33 +02:00
parent 41d7ae9a2c
commit ef57c90526
2 changed files with 5 additions and 6 deletions

View File

@ -309,10 +309,9 @@ def validate_config(raw_config, schemas, extensions=None):
def create_file_structures():
path.get_or_create_dir(path.expand_path('$XDG_DATA_DIR/mopidy'))
path.get_or_create_dir(path.expand_path('$XDG_CONFIG_DIR/mopidy'))
path.get_or_create_file(
path.expand_path('$XDG_CONFIG_DIR/mopidy/mopidy.conf'))
path.get_or_create_dir('$XDG_DATA_DIR/mopidy')
path.get_or_create_dir('$XDG_CONFIG_DIR/mopidy')
path.get_or_create_file('$XDG_CONFIG_DIR/mopidy/mopidy.conf')
def setup_audio(config):

View File

@ -28,7 +28,7 @@ XDG_DIRS = {
def get_or_create_dir(dir_path):
dir_path = os.path.expanduser(dir_path)
dir_path = expand_path(dir_path)
if os.path.isfile(dir_path):
raise OSError(
'A file with the same name as the desired dir, '
@ -40,7 +40,7 @@ def get_or_create_dir(dir_path):
def get_or_create_file(filename):
filename = os.path.expanduser(filename)
filename = expand_path(filename)
if not os.path.isfile(filename):
logger.info('Creating file %s', filename)
open(filename, 'w')