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.