linux (and probably mac): fix copying of example config in case of missing config file

This commit is contained in:
Steffen Schaumburg 2011-03-19 22:10:45 +01:00
parent 43b071515d
commit d6b3197fb6

View File

@ -78,7 +78,6 @@ def get_exec_path():
def get_config(file_name, fallback = True):
"""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
config_found,example_found,example_copy = False,False,False
config_path, example_path = None,None
@ -111,6 +110,13 @@ def get_config(file_name, fallback = True):
example_copy = True
msg = _("Config file has been created at %s.\n") % config_path
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:
pass