Add get_or_create_dotdir util function

This commit is contained in:
Stein Magnus Jodal 2010-03-23 00:23:11 +01:00
parent 93b981de07
commit 79b5942831

View File

@ -1,5 +1,6 @@
import logging
from multiprocessing.reduction import reduce_connection
import os
import pickle
logger = logging.getLogger('mopidy.utils')
@ -21,6 +22,13 @@ def get_class(name):
class_object = getattr(module, class_name)
return class_object
def get_or_create_dotdir():
dotdir = os.path.expanduser(u'~/.mopidy/')
if not os.path.isdir(dotdir):
logger.info(u'Creating %s', dotdir)
os.mkdir(dotdir, 0755)
return dotdir
def indent(string, places=4, linebreak='\n'):
lines = string.split(linebreak)
if len(lines) == 1: