loading files from a diialogue
William Labbett

Hi,

a simple question. I'm hoping for confirmation.

This code doesn't do what I wrote it for. When I use the dialogue to change to a subdirectory, then the file doesn't load. Is the reason for this that

al_get_path_filename(((FilesListBox *) data.vp)->file_paths[index]);

only returns the file name and so is not prefixed by the directory name?

((FilesListBox *) data.vp)->file_paths[index] = al_create_path(al_get_native_file_dialog_path(cur_dialog->file_dialog, 0));

            ((FilesListBox *) data.vp)->file_names[index] = al_get_path_filename(((FilesListBox *) data.vp)->file_paths[index]);

            /* Load the file. */
            if((((FilesListBox *) data.vp)->bitmaps[index] = al_load_bitmap( ((FilesListBox *) data.vp)->file_names[index] ) ) == NULL)

I think if I use

al_load_bitmap( ((FilesListBox *) data.vp)->file_paths[index])

instead, it will work. Is this right?

Edgar Reynaldo

You want al_path_cstr.

William Labbett

Thanks.

Thread #618628. Printed from Allegro.cc