*/
typedef void *(*aco_snapshot_alloc)(void);
+/*! \brief The representation of a single configuration file to be processed */
struct aco_file {
- const char *filename;
- const char **preload;
+ const char *filename; /*!< \brief The filename to be processed */
+ const char *alias; /*!< \brief An alias filename to be tried if 'filename' cannot be found */
+ const char **preload; /*!< \brief A null-terminated oredered array of categories to be loaded first */
struct aco_type *types[]; /*!< The list of types for this config. Required. Use a sentinel! */
};
}
while (res != ACO_PROCESS_ERROR && (file = info->files[x++])) {
- if (!(cfg = ast_config_load(file->filename, cfg_flags))) {
+ const char *filename = file->filename;
+try_alias:
+ if (!(cfg = ast_config_load(filename, cfg_flags))) {
+ if (file->alias && strcmp(file->alias, filename)) {
+ filename = file->alias;
+ goto try_alias;
+ }
ast_log(LOG_ERROR, "Unable to load config file '%s'\n", file->filename);
res = ACO_PROCESS_ERROR;
break;
res = ACO_PROCESS_ERROR;
break;
} else if (cfg == CONFIG_STATUS_FILEMISSING) {
+ if (file->alias && strcmp(file->alias, filename)) {
+ filename = file->alias;
+ goto try_alias;
+ }
ast_log(LOG_ERROR, "%s is missing! Cannot load %s\n", file->filename, info->module);
res = ACO_PROCESS_ERROR;
break;