linux (and probably mac): fix copying of example config in case of missing config file
This commit is contained in:
parent
43b071515d
commit
d6b3197fb6
|
@ -78,7 +78,6 @@ def get_exec_path():
|
||||||
|
|
||||||
def get_config(file_name, fallback = True):
|
def get_config(file_name, fallback = True):
|
||||||
"""Looks in cwd and in self.default_config_path for a config file."""
|
"""Looks in cwd and in self.default_config_path for a config file."""
|
||||||
|
|
||||||
# look for example file even if not used here, path is returned to caller
|
# look for example file even if not used here, path is returned to caller
|
||||||
config_found,example_found,example_copy = False,False,False
|
config_found,example_found,example_copy = False,False,False
|
||||||
config_path, example_path = None,None
|
config_path, example_path = None,None
|
||||||
|
@ -111,6 +110,13 @@ def get_config(file_name, fallback = True):
|
||||||
example_copy = True
|
example_copy = True
|
||||||
msg = _("Config file has been created at %s.\n") % config_path
|
msg = _("Config file has been created at %s.\n") % config_path
|
||||||
logging.info(msg)
|
logging.info(msg)
|
||||||
|
except IOError:
|
||||||
|
try:
|
||||||
|
example_path = file_name + '.example'
|
||||||
|
shutil.copyfile(example_path, config_path)
|
||||||
|
example_copy = True
|
||||||
|
msg = _("Config file has been created at %s.\n") % config_path
|
||||||
|
logging.info(msg)
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user