diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/shortcuts.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 5453422b43..adac5e3327 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -482,15 +482,15 @@ static int shortcut_menu_speak_item(int selected_item, void * data) | |||
482 | { | 482 | { |
483 | case SHORTCUT_BROWSER: | 483 | case SHORTCUT_BROWSER: |
484 | { | 484 | { |
485 | static char path[MAX_PATH]; | ||
486 | DIR* dir; | 485 | DIR* dir; |
487 | struct dirent* entry; | 486 | struct dirent* entry; |
488 | char* filename = strrchr(sc->u.path, PATH_SEPCH) + 1; | 487 | char* slash = strrchr(sc->u.path, PATH_SEPCH); |
489 | if (*filename != '\0') | 488 | char* filename = slash + 1; |
489 | if (slash && *filename != '\0') | ||
490 | { | 490 | { |
491 | int dirlen = (filename - sc->u.path); | 491 | *slash = '\0'; /* terminate the path to open the directory */ |
492 | strmemccpy(path, sc->u.path, dirlen + 1); | 492 | dir = opendir(sc->u.path); |
493 | dir = opendir(path); | 493 | *slash = PATH_SEPCH; /* restore fullpath */ |
494 | if (dir) | 494 | if (dir) |
495 | { | 495 | { |
496 | while (0 != (entry = readdir(dir))) | 496 | while (0 != (entry = readdir(dir))) |
@@ -498,9 +498,12 @@ static int shortcut_menu_speak_item(int selected_item, void * data) | |||
498 | if (!strcmp(entry->d_name, filename)) | 498 | if (!strcmp(entry->d_name, filename)) |
499 | { | 499 | { |
500 | struct dirinfo info = dir_get_info(dir, entry); | 500 | struct dirinfo info = dir_get_info(dir, entry); |
501 | |||
501 | if (info.attribute & ATTR_DIRECTORY) | 502 | if (info.attribute & ATTR_DIRECTORY) |
502 | talk_dir_or_spell(sc->u.path, NULL, false); | 503 | talk_dir_or_spell(sc->u.path, NULL, false); |
503 | else talk_file_or_spell(path, filename, NULL, false); | 504 | else |
505 | talk_file_or_spell(NULL, sc->u.path, NULL, false); | ||
506 | |||
504 | closedir(dir); | 507 | closedir(dir); |
505 | return 0; | 508 | return 0; |
506 | } | 509 | } |