Act correctly when -c is used with empty argument
This commit is contained in:
parent
0d6f76b256
commit
7c33bffdb2
@ -45,11 +45,12 @@ class Config(ConfigParser):
|
|||||||
|
|
||||||
def init_config(self):
|
def init_config(self):
|
||||||
logging.info("Initializing default config.")
|
logging.info("Initializing default config.")
|
||||||
|
if self.configdir is None:
|
||||||
|
self.read_dict(default_config)
|
||||||
|
return
|
||||||
cp = ConfigParser()
|
cp = ConfigParser()
|
||||||
cp.optionxform = lambda opt: opt # be case-insensitive
|
cp.optionxform = lambda opt: opt # be case-insensitive
|
||||||
cp.read_dict(default_config)
|
cp.read_dict(default_config)
|
||||||
if self.configdir is None:
|
|
||||||
return
|
|
||||||
if not os.path.exists(self.configdir):
|
if not os.path.exists(self.configdir):
|
||||||
os.makedirs(self.configdir, 0o755)
|
os.makedirs(self.configdir, 0o755)
|
||||||
with open(self.configfile, 'w') as f:
|
with open(self.configfile, 'w') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user