Merge pull request #339 from zas/config_path_in_debug

Display configuration file or registry path in debug log
This commit is contained in:
Laurent Monin
2014-06-14 15:19:30 +02:00
2 changed files with 20 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import re
import sys
from operator import itemgetter
from PyQt4 import QtCore
from picard import (PICARD_APP_NAME, PICARD_ORG_NAME, PICARD_VERSION,
@@ -236,3 +237,17 @@ _config = Config()
setting = _config.setting
persist = _config.persist
# http://pyqt.sourceforge.net/Docs/PyQt4/qsettings.html#fileName
# QString QSettings.fileName (self)
#
# Returns the path where settings written using this QSettings object are stored.
#
# On Windows, if the format is QSettings.NativeFormat, the return value is a system registry path, not a file path.
FILE_PATH = 0
REGISTRY_PATH = 1
storage = _config.fileName()
if _config.format() == QtCore.QSettings.NativeFormat and sys.platform == "win32":
storage_type = REGISTRY_PATH
else:
storage_type = FILE_PATH

View File

@@ -138,6 +138,10 @@ class Tagger(QtGui.QApplication):
log.debug("Starting Picard %s from %r", picard.__version__, os.path.abspath(__file__))
log.debug("Platform: %s %s %s", platform.platform(),
platform.python_implementation(), platform.python_version())
if config.storage_type == config.REGISTRY_PATH:
log.debug("Configuration registry path: %s", config.storage)
else:
log.debug("Configuration file path: %s", config.storage)
# TODO remove this before the final release
if sys.platform == "win32":
@@ -151,6 +155,7 @@ class Tagger(QtGui.QApplication):
shutil.move(olduserdir, USER_DIR)
except:
pass
log.debug("User directory: %s", os.path.abspath(USER_DIR))
# for compatibility with pre-1.3 plugins
QtCore.QObject.tagger = self