Try using ANDROID_PRIVATE instead of HOME if not found
This commit is contained in:
parent
84482f2627
commit
beb15d9b77
15
src/paths.py
15
src/paths.py
|
@ -52,20 +52,27 @@ def lookupAppdataFolder():
|
|||
sys.getfilesystemencoding(), 'ignore'), APPNAME
|
||||
) + os.path.sep
|
||||
else:
|
||||
homedir = os.environ.get('XDG_CONFIG_HOME')
|
||||
if not homedir:
|
||||
try:
|
||||
dataFolder = os.path.join(os.environ['XDG_CONFIG_HOME'], APPNAME)
|
||||
homedir = os.path.join(os.environ['HOME'], '.config')
|
||||
except KeyError:
|
||||
dataFolder = os.path.join(os.environ['HOME'], '.config', APPNAME)
|
||||
# Nonstandard environment, try android vars
|
||||
homedir = os.environ.get('ANDROID_PRIVATE')
|
||||
|
||||
dataFolder = os.path.join(homedir, APPNAME)
|
||||
|
||||
# Migrate existing data to the proper location
|
||||
# if this is an existing install
|
||||
try:
|
||||
move(os.path.join(os.environ['HOME'], '.%s' % APPNAME), dataFolder)
|
||||
move(
|
||||
os.path.join(os.environ.get('HOME', ''), '.%s' % APPNAME),
|
||||
dataFolder)
|
||||
logger.info('Moving data folder to %s', dataFolder)
|
||||
except IOError:
|
||||
# Old directory may not exist.
|
||||
pass
|
||||
dataFolder = dataFolder + os.path.sep
|
||||
dataFolder += os.path.sep
|
||||
return dataFolder
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user