PICARD-118: Set cache location to portable config dir

This commit is contained in:
Philipp Wolfer
2019-10-14 10:44:41 +02:00
committed by Philipp Wolfer
parent 02cf4cddc0
commit ebfd17574a
3 changed files with 11 additions and 5 deletions

View File

@@ -12,8 +12,7 @@ import picard.const
# The portable version stores all data in a folder beside the executable
configdir = '{}-{}'.format(PICARD_ORG_NAME, PICARD_APP_NAME)
basedir = os.path.join(os.path.dirname(sys.executable), configdir)
if not os.path.exists(basedir):
os.makedirs(basedir)
os.makedirs(basedir, exist_ok=True)
# Setup config file if not specified as command line argument
if '--config-file' not in sys.argv and '-c' not in sys.argv:
@@ -22,3 +21,8 @@ if '--config-file' not in sys.argv and '-c' not in sys.argv:
# Setup plugin folder
picard.const.USER_PLUGIN_DIR = os.path.join(basedir, 'Plugins')
# Set standard cache location
cachedir = os.path.join(basedir, 'Cache')
os.makedirs(cachedir, exist_ok=True)
picard.const.CACHE_DIR = cachedir