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.
This commit is contained in:
Florian Bruhin 2015-02-18 22:07:01 +01:00
parent 9534deb2e7
commit 3d72235023

View File

@ -32,7 +32,8 @@ import configparser
import collections import collections
import collections.abc 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 PyQt5.QtWidgets import QMessageBox
from qutebrowser.config import configdata, configexc, textwrapper from qutebrowser.config import configdata, configexc, textwrapper
@ -205,6 +206,18 @@ def _init_misc(args):
save_manager.add_saveable('command-history', command_history.save, save_manager.add_saveable('command-history', command_history.save,
command_history.changed) command_history.changed)
# 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)
def init(args): def init(args):
"""Initialize the config. """Initialize the config.