Merge pull request #261 from xj9/xdg

Fixed issue #157: Use $XDG_CONFIG_HOME
This commit is contained in:
Jonathan Warren 2013-06-26 10:54:37 -07:00
commit e9fbbe3dcc

View File

@ -124,7 +124,18 @@ def lookupAppdataFolder():
elif 'win32' in sys.platform or 'win64' in sys.platform: elif 'win32' in sys.platform or 'win64' in sys.platform:
dataFolder = path.join(environ['APPDATA'], APPNAME) + '\\' dataFolder = path.join(environ['APPDATA'], APPNAME) + '\\'
else: else:
dataFolder = path.expanduser(path.join("~", "." + APPNAME + "/")) from shutil import move
try:
dataFolder = path.join(environ["XDG_CONFIG_HOME"], APPNAME)
except KeyError:
dataFolder = path.join(environ["HOME"], ".config", APPNAME)
# Migrate existing data to the proper location if this is an existing install
try:
print "Moving data folder to ~/.config/%s" % APPNAME
move(path.join(environ["HOME"], ".%s" % APPNAME), dataFolder)
dataFolder = dataFolder + '/'
except IOError:
dataFolder = dataFolder + '/'
return dataFolder return dataFolder
def isAddressInMyAddressBook(address): def isAddressInMyAddressBook(address):