diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-06-01 18:19:56 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-06-01 18:27:09 -0400 |
commit | 5d34887d4ac3c3a2fcd6827f3ca70def65336591 (patch) | |
tree | 911558852eccb193d7bcc9225f99a9e4950b8555 | |
parent | e16230de8c4b671eb6e2a067c2e1d4388852e8ec (diff) | |
download | rockbox-5d34887d4a.tar.gz rockbox-5d34887d4a.zip |
voice: regression: Don't mangle the filename when spelling it out.
26c612f breaks file selections if you have filename extensions disabled
and filenames spelled out, because it modified the filename in place
breaking the caller.
Instead of using a lot of space to make a private copy, the simplest
approach is, if we strip the extension off, simply restore it
afterwards.
Change-Id: Iaf560e813053b8030c620bbed6d061a2423338d5
-rw-r--r-- | apps/tree.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/tree.c b/apps/tree.c index 58457c2d71..f40e6eaa2a 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -276,9 +276,11 @@ static int tree_voice_cb(int selected_item, void * data) /* spell name AFTER voicing filetype */ if (spell_name) { + bool stripit = false; + char *ext = NULL; + /* Don't spell the extension if it's not displayed */ if (!is_dir) { - bool stripit; switch(global_settings.show_filename_ext) { case 0: /* show file extension: off */ @@ -301,13 +303,15 @@ static int tree_voice_cb(int selected_item, void * data) } if (stripit) { - char *ext = strrchr(name, '.'); + ext = strrchr(name, '.'); if (ext) *ext = 0; } } - talk_spell(name, true); + + if (stripit && ext) + *ext = '.'; } return 0; |