RaaA: app_rename() must also do ROCKBOX_DIR translation for the target path

Fixes the "recent bookmarks" feature

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29316 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Jarosch 2011-02-15 22:46:36 +00:00
parent 3ced180f5d
commit 351c851d08

View file

@ -168,13 +168,21 @@ int app_remove(const char *name)
int app_rename(const char *old, const char *new) int app_rename(const char *old, const char *new)
{ {
char realpath[MAX_PATH]; char realpath_old[MAX_PATH], realpath_new[MAX_PATH];
const char *fname = old;
const char *final_old = old;
if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN)) if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN))
{ {
fname = _get_user_file_path(old, NEED_WRITE, realpath, sizeof(realpath)); final_old = _get_user_file_path(old, NEED_WRITE, realpath_old, sizeof(realpath_old));
} }
return rename(fname, new);
const char *final_new = new;
if (!strncmp(ROCKBOX_DIR, new, ROCKBOX_DIR_LEN))
{
final_new = _get_user_file_path(new, NEED_WRITE, realpath_new, sizeof(realpath_new));
}
return rename(final_old, final_new);
} }
DIR *app_opendir(const char *name) DIR *app_opendir(const char *name)