[AD] al_make_recursive_directory

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Can we get it for 5.0? Right now I need this:

ALLEGRO_CONFIG *get_config() {
    ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH);
    ALLEGRO_PATH *path2 = al_create_path(NULL);
    for (int i = 0; i < al_get_path_num_components(path); i++) {
        al_path_append_component(path2, al_path_get_component(path, i));
        al_make_directory(al_path_cstr(path2);
    }
    al_set_path_filename(path, "my_config.ini");
    ALLEGRO_CONFIG *config = al_load_config_file(al_path_cstr(path, '/'));
    if (!config) config = al_create_config();
    al_destroy_path(path);
    return config;
}

With al_make_recursive_directory it would be simplified to this:

ALLEGRO_CONFIG *get_config() {
    ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH);
    al_make_recursive_directory(al_path_cstr(path, '/'));
    al_set_path_filename(path, "my_config.ini");
    ALLEGRO_CONFIG *config = al_load_config_file(al_path_cstr(path, '/'));
    if (!config) config = al_create_config();
    al_destroy_path(path);
    return config;
}

And maybe even this would make sense as about any game will want
something like it:

ALLEGRO_CONFIG *get_config() {
    return al_get_standard_config();
}

It would be matched by an al_save_standard_config to write the file back
to the same location.

Also I think the default "organization" should be empty and not
"allegro" so when i use: al_set_app_name("mygame") it will save into
~/.config/mygame/ and not ~/.config/allegro/mygame/ as it does right
now...

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/