Move handling of --confdir into get_standard_dir
This commit is contained in:
parent
9e8ee00777
commit
b20536d472
@ -87,12 +87,7 @@ def init(args):
|
||||
Args:
|
||||
args: The argparse namespace.
|
||||
"""
|
||||
if args.confdir is None:
|
||||
confdir = utils.get_standard_dir(QStandardPaths.ConfigLocation)
|
||||
elif args.confdir == '':
|
||||
confdir = None
|
||||
else:
|
||||
confdir = args.confdir
|
||||
confdir = utils.get_standard_dir(QStandardPaths.ConfigLocation, args)
|
||||
try:
|
||||
app = objreg.get('app')
|
||||
config_obj = ConfigManager(confdir, 'qutebrowser.conf', app)
|
||||
|
@ -168,13 +168,23 @@ def pastebin(text):
|
||||
return url
|
||||
|
||||
|
||||
def get_standard_dir(typ):
|
||||
def get_standard_dir(typ, args=None):
|
||||
"""Get the directory where files of the given type should be written to.
|
||||
|
||||
Args:
|
||||
typ: A member of the QStandardPaths::StandardLocation enum,
|
||||
see http://qt-project.org/doc/qt-5/qstandardpaths.html#StandardLocation-enum
|
||||
args: An argparse namespace which could be used to override the
|
||||
locations.
|
||||
"""
|
||||
if args is not None:
|
||||
if typ == QStandardPaths.ConfigLocation:
|
||||
if args.confdir is None:
|
||||
pass
|
||||
elif args.confdir == '':
|
||||
return None
|
||||
else:
|
||||
return args.confdir
|
||||
qapp = QCoreApplication.instance()
|
||||
orgname = qapp.organizationName()
|
||||
# We need to temporarily unset the organisationname here since the
|
||||
|
Loading…
Reference in New Issue
Block a user