parent
ec07e4f8be
commit
0ecf8661eb
@ -86,23 +86,24 @@ def get(typ, args=None):
|
|||||||
locations.
|
locations.
|
||||||
"""
|
"""
|
||||||
overridden, path = _from_args(typ, args)
|
overridden, path = _from_args(typ, args)
|
||||||
if overridden:
|
if not overridden:
|
||||||
return path
|
path = _writable_location(typ)
|
||||||
path = _writable_location(typ)
|
appname = QCoreApplication.instance().applicationName()
|
||||||
appname = QCoreApplication.instance().applicationName()
|
if (typ == QStandardPaths.ConfigLocation and
|
||||||
if (typ == QStandardPaths.ConfigLocation and
|
path.split(os.sep)[-1] != appname):
|
||||||
path.split(os.sep)[-1] != appname):
|
# WORKAROUND - see
|
||||||
# WORKAROUND - see
|
# https://bugreports.qt-project.org/browse/QTBUG-38872
|
||||||
# https://bugreports.qt-project.org/browse/QTBUG-38872
|
path = os.path.join(path, appname)
|
||||||
path = os.path.join(path, appname)
|
if typ == QStandardPaths.DataLocation and os.name == 'nt':
|
||||||
if typ == QStandardPaths.DataLocation and os.name == 'nt':
|
# Under windows, config/data might end up in the same directory.
|
||||||
# Under windows, config/data might end up in the same directory.
|
data_path = QStandardPaths.writableLocation(
|
||||||
data_path = QStandardPaths.writableLocation(
|
QStandardPaths.DataLocation)
|
||||||
QStandardPaths.DataLocation)
|
config_path = QStandardPaths.writableLocation(
|
||||||
config_path = QStandardPaths.writableLocation(
|
QStandardPaths.ConfigLocation)
|
||||||
QStandardPaths.ConfigLocation)
|
if data_path == config_path:
|
||||||
if data_path == config_path:
|
path = os.path.join(path, 'data')
|
||||||
path = os.path.join(path, 'data')
|
if not os.path.exists(path):
|
||||||
|
os.makedirs(path, 0o700)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user