From 118316b0ea7b6775b41848841701141987ece108 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 10 Mar 2003 14:31:43 +0000 Subject: Now only shows extensions in mode Show files: All git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3407 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index fb748a56d6..6f29a43e2d 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -194,18 +194,22 @@ static int compare(const void* p1, const void* p2) static void showfileline(int line, int direntry, bool scroll) { - /* if music filter is on, cut off the extension */ - if (global_settings.dirfilter == SHOW_MUSIC && - (dircache[direntry].attr & (TREE_ATTR_M3U|TREE_ATTR_MPA))) + /* if any file filter is on, strip the extension */ + if (global_settings.dirfilter != SHOW_ALL && + !(dircache[direntry].attr & ATTR_DIRECTORY)) { - int len = strlen(dircache[direntry].name); - char temp = dircache[direntry].name[len-4]; - dircache[direntry].name[len-4] = 0; + char* dotpos = strrchr(dircache[direntry].name, '.'); + char temp; + if (dotpos) { + temp = *dotpos; + *dotpos = 0; + } if(scroll) lcd_puts_scroll(LINE_X, line, dircache[direntry].name); else lcd_puts(LINE_X, line, dircache[direntry].name); - dircache[direntry].name[len-4] = temp; + if (dotpos) + *dotpos = temp; } else { if(scroll) -- cgit v1.2.3