summaryrefslogtreecommitdiff
path: root/apps/plugins/shortcuts/shortcuts_common.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-08-19 13:46:59 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-08-19 13:46:59 +0000
commit237d36cd93e5ebd7d2c0942927f25e3805ca9ace (patch)
tree61b10da6aaa900892544b8a61ce6b207076cc42a /apps/plugins/shortcuts/shortcuts_common.c
parente6b53c7c90775f287e9afa20b3e32704b53bf87c (diff)
shortcuts_view: fix displaying last path segments so that plugin exactly shows what is said in the manual.
fix bug it shows "Bad entry selected!" when exit right after delete last item. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22428 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/shortcuts/shortcuts_common.c')
-rw-r--r--apps/plugins/shortcuts/shortcuts_common.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c
index 1a781b23eb..68817d3081 100644
--- a/apps/plugins/shortcuts/shortcuts_common.c
+++ b/apps/plugins/shortcuts/shortcuts_common.c
@@ -222,11 +222,11 @@ bool parse_entry_content(char *line, sc_entry_t *entry, int last_segm)
char *last_segments(char *path, int nsegm)
{
- char *p = rb->strrchr(path, PATH_SEPARATOR[0]); /* Hack */
- int seg_cnt;
- if (p == NULL)
- return path; /* No separator??? */
- seg_cnt = 0;
+ /* don't count one trailing separator */
+ char *p = path+rb->strlen(path)-PATH_SEPARATOR_LEN;
+ int seg_cnt = 0;
+ if(p <= path)
+ return path;
while ((p > path) && (seg_cnt < nsegm)) {
p--;
if (!starts_with(p, PATH_SEPARATOR)) {