diff options
author | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-01-18 10:02:03 +0000 |
---|---|---|
committer | Nicolas Pennequin <nicolas.pennequin@free.fr> | 2008-01-18 10:02:03 +0000 |
commit | 536b5a0482454d3e3104f2a77a29d37319bc845c (patch) | |
tree | 9c49613ba5723a0d615c4ad41f84e641dfd14fda /apps/misc.c | |
parent | 905d80619c3f7dec778fd29fa9ec77dda2ac8bcf (diff) |
Accept FS#8469 by Bryan Childs with a few adjustments: Remove duplicate strip_extension() function from albumart.c. The other one is moved from tree.c to misc.c.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16103 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/misc.c b/apps/misc.c index 85ab396754..a85169598f 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -1120,3 +1120,22 @@ bool dir_exists(const char *path) closedir(d); return true; } + +/* + * removes the extension of filename (if it doesn't start with a .) + * puts the result in buffer + */ +char *strip_extension(const char *filename, char *buffer) +{ + int dotpos; + char *dot = strrchr(filename, '.'); + if (dot != 0 && filename[0] != '.') + { + dotpos = dot - filename; + strncpy(buffer, filename, dotpos); + buffer[dotpos] = '\0'; + } + else + strcpy(buffer, filename); + return buffer; +} |