trunk/src/emu/ui/filesel.c
| r30706 | r30707 | |
| 546 | 546 | |
| 547 | 547 | // open the directory |
| 548 | 548 | err = zippath_opendir(path, &directory); |
| 549 | | if (err != FILERR_NONE) |
| 550 | | goto done; |
| 551 | 549 | |
| 552 | 550 | // clear out the menu entries |
| 553 | 551 | m_entrylist = NULL; |
| r30706 | r30707 | |
| 580 | 578 | } |
| 581 | 579 | |
| 582 | 580 | // build the menu for each item |
| 583 | | while((dirent = zippath_readdir(directory)) != NULL) |
| 581 | if (err == FILERR_NONE) |
| 584 | 582 | { |
| 585 | | // append a dirent entry |
| 586 | | entry = append_dirent_entry(dirent); |
| 587 | | |
| 588 | | if (entry != NULL) |
| 583 | while((dirent = zippath_readdir(directory)) != NULL) |
| 589 | 584 | { |
| 590 | | // set the selected item to be the first non-parent directory or file |
| 591 | | if ((selected_entry == NULL) && strcmp(dirent->name, "..")) |
| 592 | | selected_entry = entry; |
| 585 | // append a dirent entry |
| 586 | entry = append_dirent_entry(dirent); |
| 593 | 587 | |
| 594 | | // do we have to select this file? |
| 595 | | if (!core_stricmp(m_current_file, dirent->name)) |
| 596 | | selected_entry = entry; |
| 588 | if (entry != NULL) |
| 589 | { |
| 590 | // set the selected item to be the first non-parent directory or file |
| 591 | if ((selected_entry == NULL) && strcmp(dirent->name, "..")) |
| 592 | selected_entry = entry; |
| 593 | |
| 594 | // do we have to select this file? |
| 595 | if (!core_stricmp(m_current_file, dirent->name)) |
| 596 | selected_entry = entry; |
| 597 | } |
| 597 | 598 | } |
| 598 | 599 | } |
| 599 | 600 | |
| r30706 | r30707 | |
| 608 | 609 | // set up custom render proc |
| 609 | 610 | customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| 610 | 611 | |
| 611 | | done: |
| 612 | 612 | if (directory != NULL) |
| 613 | 613 | zippath_closedir(directory); |
| 614 | 614 | } |