Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » loading files from a diialogue

This thread is locked; no one can reply to it. rss feed Print
loading files from a diialogue
William Labbett
Member #4,486
March 2004
avatar

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
Major Reynaldo
May 2007
avatar

William Labbett
Member #4,486
March 2004
avatar

Thanks.

Go to: