From 3d72235023411274e3e637081d2384e63165bed8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 18 Feb 2015 22:07:01 +0100 Subject: [PATCH] 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. --- qutebrowser/config/config.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 9282df871..8f5ac672b 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 @@ -205,6 +206,18 @@ def _init_misc(args): save_manager.add_saveable('command-history', command_history.save, 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): """Initialize the config.