use default config file on parsing errors

This commit is contained in:
Nikos Ntarmos 2008-01-05 09:24:43 +01:00 committed by Julien Danjou
parent 64658bcf93
commit 3bd36a4749

View file

@ -729,12 +729,17 @@ config_parse(const char *confpatharg)
if(ret == CFG_FILE_ERROR)
{
perror("awesome: parsing configuration file failed");
cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG);
if(!(defconfig = fopen(confpath, "w")))
perror("awesome: unable to create default configuration file");
}
else if(ret == CFG_PARSE_ERROR)
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
if(ret != CFG_SUCCESS) {
fprintf(stderr, "Using default compile-time configuration\n");
cfg_free(cfg);
cfg = cfg_init(opts, CFGF_NONE);
cfg_parse_buf(cfg, AWESOME_DEFAULT_CONFIG);
}
/* get the right screen section */
for(screen = 0; screen < get_screen_count(); screen++)