summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2015-02-18 22:07:01 +0100
committerFlorian Bruhin <git@the-compiler.org>2015-03-18 22:20:53 +0100
commite02897ec80cd6dc08c1d784698148bdec0b5a0e2 (patch)
tree0096e426b86f50b3ab08ba60bb75149d5d8ef254
parentab011cde5b1300720844cb6d185cbf267e717d95 (diff)
downloadqutebrowser-e02897ec80cd6dc08c1d784698148bdec0b5a0e2.tar.gz
qutebrowser-e02897ec80cd6dc08c1d784698148bdec0b5a0e2.zip
Set the QSettings path to a config-subdirectory.
QWebInspector uses QSettings to save its GUI-settings. However, the default path for QSettings is ~/.config/qutebrowser/qutebrowser.conf which overwrites our own config file. This fixes one part of #515.
-rw-r--r--qutebrowser/config/config.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py
index 504578e41..18e17eadb 100644
--- a/qutebrowser/config/config.py
+++ b/qutebrowser/config/config.py
@@ -32,7 +32,8 @@ import configparser
import collections
import collections.abc
-from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QStandardPaths, QUrl
+from PyQt5.QtCore import (pyqtSignal, pyqtSlot, QObject, QStandardPaths, QUrl,
+ QSettings)
from PyQt5.QtWidgets import QMessageBox
from qutebrowser.config import configdata, configexc, textwrapper
@@ -164,6 +165,18 @@ def init(args):
('completion', 'history-length'))
objreg.register('command-history', command_history)
+ # Set the QSettings path to something like
+ # ~/.config/qutebrowser/qsettings/qutebrowser/qutebrowser.conf so it
+ # doesn't overwrite our config.
+ #
+ # This fixes one of the corruption issues here:
+ # https://github.com/The-Compiler/qutebrowser/issues/515
+
+ config_path = standarddir.get(QStandardPaths.ConfigLocation, args)
+ path = os.path.join(config_path, 'qsettings')
+ for fmt in (QSettings.NativeFormat, QSettings.IniFormat):
+ QSettings.setPath(fmt, QSettings.UserScope, path)
+
class ConfigManager(QObject):