static void read_allegro_cfg(void) { /* We assume that the stdio file interface is in effect. */ ALLEGRO_PATH *path; ALLEGRO_CONFIG *temp; if (!sys_config) sys_config = al_create_config(); #if defined(ALLEGRO_UNIX) && !defined(ALLEGRO_IPHONE) temp = al_load_config_file("/etc/allegro5rc"); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); } path = _al_unix_get_path(ALLEGRO_USER_HOME_PATH); if (path) { al_set_path_filename(path, "allegro5rc"); temp = al_load_config_file(al_path_cstr(path, '/')); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); } al_set_path_filename(path, ".allegro5rc"); temp = al_load_config_file(al_path_cstr(path, '/')); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); } al_destroy_path(path); } #endif path = early_get_exename_path(); if (path) { al_set_path_filename(path, "allegro5.cfg"); temp = al_load_config_file(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); } al_destroy_path(path); } /* Reconfigure logging in case something changed. */ _al_configure_logging(); }
/* al_get_standard_path() does not work before the system driver is * initialised. Before that, we need to call the underlying functions * directly. */ static ALLEGRO_PATH *early_get_exename_path(void) { #if defined(ALLEGRO_WINDOWS) return _al_win_get_path(ALLEGRO_EXENAME_PATH); #elif defined(ALLEGRO_MACOSX) return _al_osx_get_path(ALLEGRO_EXENAME_PATH); #elif defined(ALLEGRO_IPHONE) return _al_iphone_get_path(ALLEGRO_EXENAME_PATH); #elif defined(ALLEGRO_UNIX) return _al_unix_get_path(ALLEGRO_EXENAME_PATH); #elif defined(ALLEGRO_ANDROID) return _al_android_get_path(ALLEGRO_EXENAME_PATH); #elif defined(ALLEGRO_SDL) return al_create_path_for_directory(SDL_GetBasePath()); #else #error early_get_exename_path not implemented #endif }