diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-07-28 16:26:00 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-07-28 17:02:43 -0400 |
commit | d5a4230901e6c6e20b03b3e9873d2f788e834d8c (patch) | |
tree | 4077d904f22bfa30d213763d9aa294a51a4782a7 /apps | |
parent | c5e1539c74f55a94655c5b06749c94227dd7fd38 (diff) | |
download | rockbox-d5a4230901e6c6e20b03b3e9873d2f788e834d8c.tar.gz rockbox-d5a4230901e6c6e20b03b3e9873d2f788e834d8c.zip |
talk: Make talk_fullpath() do the right thing when voicing a directory
The component after the final '/' can be a directory, so don't
unconditionally treat it as a file.
Also check to make sure there is something after the final '/' otherwise
we end up voicing it as '//'
Change-Id: I56d69ea3f299e524df29c328ec9eeb3cfc22ff42
Diffstat (limited to 'apps')
-rw-r--r-- | apps/talk.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/talk.c b/apps/talk.c index c590c5db1b..b5622ad6d1 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -1232,8 +1232,18 @@ int talk_fullpath(const char* path, bool enqueue) | |||
1232 | ptr = strchr(start, PATH_SEPCH); | 1232 | ptr = strchr(start, PATH_SEPCH); |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | /* no more slashes, final component is a filename */ | 1235 | /* no more slashes, figure out final component */ |
1236 | return talk_file_or_spell(NULL, buf, NULL, true); | 1236 | if (!*start) { |
1237 | return 1; | ||
1238 | } | ||
1239 | |||
1240 | DIR* dir = opendir(buf); | ||
1241 | if (dir) { | ||
1242 | closedir(dir); | ||
1243 | return talk_dir_or_spell(buf, NULL, true); | ||
1244 | } else { | ||
1245 | return talk_file_or_spell(NULL, buf, NULL, true); | ||
1246 | } | ||
1237 | } | 1247 | } |
1238 | 1248 | ||
1239 | /* say a numeric value, this word ordering works for english, | 1249 | /* say a numeric value, this word ordering works for english, |