# HG changeset patch # User Goffi # Date 1616269327 -3600 # Node ID acb28399480f864d9c84acdb1a2e2f6fef0335d0 # Parent 7892585b7e17ab6c3443d0def78ed800049b9eaa tools (config): show a warning when no config file has been found + don't use hardcoded filename in `fixConfigOption` diff -r 7892585b7e17 -r acb28399480f sat/tools/config.py --- a/sat/tools/config.py Sat Mar 20 20:42:07 2021 +0100 +++ b/sat/tools/config.py Sat Mar 20 20:42:07 2021 +0100 @@ -58,7 +58,9 @@ break if not target_file: # ... otherwise we create a new config file for that user - target_file = BaseDirectory.save_config_path("sat") + "/sat.conf" + target_file = ( + f"{BaseDirectory.save_config_path(C.APP_NAME_FILE)}/{C.APP_NAME_FILE}.conf" + ) if section and section.upper() != DEFAULTSECT and not config.has_section(section): config.add_section(section) config.set(section, option, value) @@ -84,9 +86,14 @@ log.error(_("Can't read main config: {msg}").format(msg=e), exc_info=True) else: if log_filenames: - log.info( - _("Configuration was read from: {filenames}").format( - filenames=', '.join(filenames))) + if filenames: + log.info( + _("Configuration was read from: {filenames}").format( + filenames=', '.join(filenames))) + else: + log.warning( + _("No configuration file found, using default settings") + ) return config