Add an init method for standarddir.
This is another preparation for #19 and #20.
This commit is contained in:
parent
4abb5c8f36
commit
b49b227c0d
@ -133,6 +133,8 @@ class Application(QApplication):
|
||||
readline_bridge = readline.ReadlineBridge()
|
||||
objreg.register('readline-bridge', readline_bridge)
|
||||
|
||||
log.init.debug("Initializing directories...")
|
||||
standarddir.init()
|
||||
log.init.debug("Initializing config...")
|
||||
config.init(self._args)
|
||||
log.init.debug("Initializing crashlog...")
|
||||
|
@ -501,8 +501,6 @@ class ConfigManager(QObject):
|
||||
"""Save the config file."""
|
||||
if self._configdir is None:
|
||||
return
|
||||
if not os.path.exists(self._configdir):
|
||||
os.makedirs(self._configdir, 0o755)
|
||||
configfile = os.path.join(self._configdir, self._fname)
|
||||
log.destroy.debug("Saving config to {}".format(configfile))
|
||||
with open(configfile, 'w', encoding='utf-8') as f:
|
||||
|
@ -104,3 +104,11 @@ def get(typ, args=None):
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
|
||||
def init():
|
||||
"""Initialize all config dirs."""
|
||||
configdir = get(QStandardPaths.ConfigLocation)
|
||||
if configdir is not None and not os.path.exists(configdir):
|
||||
# FIXME
|
||||
os.makedirs(configdir, 0o755)
|
||||
|
Loading…
Reference in New Issue
Block a user