Set orgname to make inspector settings persistent
This commit is contained in:
parent
24543edcbe
commit
d00a946497
@ -236,6 +236,7 @@ class QuteBrowser(QApplication):
|
|||||||
|
|
||||||
def _init_misc(self):
|
def _init_misc(self):
|
||||||
"""Initialize misc things."""
|
"""Initialize misc things."""
|
||||||
|
self.setOrganizationName("qutebrowser")
|
||||||
self.setApplicationName("qutebrowser")
|
self.setApplicationName("qutebrowser")
|
||||||
self.setApplicationVersion(qutebrowser.__version__)
|
self.setApplicationVersion(qutebrowser.__version__)
|
||||||
self.messagebridge = MessageBridge()
|
self.messagebridge = MessageBridge()
|
||||||
|
@ -210,18 +210,28 @@ def get_standard_dir(typ):
|
|||||||
typ: A member of the QStandardPaths::StandardLocation enum,
|
typ: A member of the QStandardPaths::StandardLocation enum,
|
||||||
see http://qt-project.org/doc/qt-5/qstandardpaths.html#StandardLocation-enum
|
see http://qt-project.org/doc/qt-5/qstandardpaths.html#StandardLocation-enum
|
||||||
"""
|
"""
|
||||||
# FIXME RuntimeLocation "can be empty on some systems", wat.
|
qapp = QCoreApplication.instance()
|
||||||
path = QStandardPaths.writableLocation(typ)
|
orgname = qapp.organizationName()
|
||||||
# Qt seems to use '/' as path separator even on Windows...
|
# We need to temporarely unset the organisationname here since the
|
||||||
path = path.replace('/', os.sep)
|
# webinspector wants it to be set to store its persistent data correctly,
|
||||||
appname = QCoreApplication.instance().applicationName()
|
# but we don't want that to happen.
|
||||||
if (typ == QStandardPaths.ConfigLocation and
|
qapp.setOrganizationName(None)
|
||||||
path.split(os.sep)[-1] != appname):
|
try:
|
||||||
# Workaround for https://bugreports.qt-project.org/browse/QTBUG-38872
|
# FIXME RuntimeLocation "can be empty on some systems", wat.
|
||||||
path = os.path.join(path, appname)
|
path = QStandardPaths.writableLocation(typ)
|
||||||
if not os.path.exists(path):
|
# Qt seems to use '/' as path separator even on Windows...
|
||||||
os.makedirs(path)
|
path = path.replace('/', os.sep)
|
||||||
return path
|
appname = qapp.applicationName()
|
||||||
|
if (typ == QStandardPaths.ConfigLocation and
|
||||||
|
path.split(os.sep)[-1] != appname):
|
||||||
|
# Workaround for
|
||||||
|
# https://bugreports.qt-project.org/browse/QTBUG-38872
|
||||||
|
path = os.path.join(path, appname)
|
||||||
|
if not os.path.exists(path):
|
||||||
|
os.makedirs(path)
|
||||||
|
return path
|
||||||
|
finally:
|
||||||
|
qapp.setOrganizationName(orgname)
|
||||||
|
|
||||||
|
|
||||||
def actute_warning():
|
def actute_warning():
|
||||||
|
Loading…
Reference in New Issue
Block a user