From 5a11e6e7a23d814ba6cb3cdecda795e4ccb35669 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 9 Mar 2018 14:17:29 +0100 Subject: [PATCH] Use QStandardPaths.AppConfigLocation --- picard/const/__init__.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/picard/const/__init__.py b/picard/const/__init__.py index 6aa96c7c6..4cd0836d0 100644 --- a/picard/const/__init__.py +++ b/picard/const/__init__.py @@ -20,6 +20,7 @@ import os import sys +from PyQt5.QtCore import QStandardPaths from picard import PICARD_APP_NAME # Install gettext "noop" function in case const.py gets imported directly. @@ -28,15 +29,8 @@ builtins.__dict__['N_'] = lambda a: a # Config directory -if sys.platform == "win32": - USER_DIR = os.environ.get("APPDATA", "~\\Application Data") -else: - USER_DIR = os.environ.get("XDG_CONFIG_HOME", "~/.config") - -USER_DIR = os.path.join( - os.path.expanduser(USER_DIR), "MusicBrainz", PICARD_APP_NAME -) - +_appconfiglocation = QStandardPaths.writableLocation(QStandardPaths.AppConfigLocation) +USER_DIR = os.path.join(_appconfiglocation, "MusicBrainz", PICARD_APP_NAME) USER_PLUGIN_DIR = os.path.join(USER_DIR, "plugins") # AcoustID client API key