forked from len0rd/rockbox
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
This commit is contained in:
parent
905d80619c
commit
536b5a0482
4 changed files with 25 additions and 48 deletions
19
apps/misc.c
19
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue