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
|
sys.getfilesystemencoding(), 'ignore'), APPNAME
|
||||||
) + os.path.sep
|
) + os.path.sep
|
||||||
else:
|
else:
|
||||||
|
homedir = os.environ.get('XDG_CONFIG_HOME')
|
||||||
|
if not homedir:
|
||||||
try:
|
try:
|
||||||
dataFolder = os.path.join(os.environ['XDG_CONFIG_HOME'], APPNAME)
|
homedir = os.path.join(os.environ['HOME'], '.config')
|
||||||
except KeyError:
|
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
|
# Migrate existing data to the proper location
|
||||||
# if this is an existing install
|
# if this is an existing install
|
||||||
try:
|
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)
|
logger.info('Moving data folder to %s', dataFolder)
|
||||||
except IOError:
|
except IOError:
|
||||||
# Old directory may not exist.
|
# Old directory may not exist.
|
||||||
pass
|
pass
|
||||||
dataFolder = dataFolder + os.path.sep
|
dataFolder += os.path.sep
|
||||||
return dataFolder
|
return dataFolder
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user