Skip to content

Commit 20994ad

Browse files
author
Jonathan Warren
committed
Merge branch 'master' of github.com:Bitmessage/PyBitmessage
2 parents 9230e40 + e9fbbe3 commit 20994ad

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

File renamed without changes.

src/shared.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,18 @@ def lookupAppdataFolder():
124124
elif 'win32' in sys.platform or 'win64' in sys.platform:
125125
dataFolder = path.join(environ['APPDATA'], APPNAME) + '\\'
126126
else:
127-
dataFolder = path.expanduser(path.join("~", "." + APPNAME + "/"))
127+
from shutil import move
128+
try:
129+
dataFolder = path.join(environ["XDG_CONFIG_HOME"], APPNAME)
130+
except KeyError:
131+
dataFolder = path.join(environ["HOME"], ".config", APPNAME)
132+
# Migrate existing data to the proper location if this is an existing install
133+
try:
134+
print "Moving data folder to ~/.config/%s" % APPNAME
135+
move(path.join(environ["HOME"], ".%s" % APPNAME), dataFolder)
136+
dataFolder = dataFolder + '/'
137+
except IOError:
138+
dataFolder = dataFolder + '/'
128139
return dataFolder
129140

130141
def isAddressInMyAddressBook(address):

0 commit comments

Comments
 (0)