forked from len0rd/rockbox
RaaA: Fix database duplication issue on every start
The code in tagcache.c:commit() was unable to delete the to-be-commited database file as it read from $(HOME)/.config/rockbox.org and tried to delete the file later on in /.rockbox/. As we didn't specify any flags like IS_FILE or NEED_WRITE in _get_user_file_path() (which is called by f.e. app_remove()), it searched for the file in two places. In case of app_rename() IS_FILE would be wrong, so we just add a NEED_WRITE to any write operation. Author: Thomas Jarosch git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29148 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b703d251be
commit
771011a6fc
1 changed files with 5 additions and 5 deletions
|
|
@ -160,8 +160,9 @@ int app_remove(const char *name)
|
||||||
const char *fname = name;
|
const char *fname = name;
|
||||||
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
||||||
{
|
{
|
||||||
fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
|
fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
return remove(fname);
|
return remove(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -171,7 +172,7 @@ int app_rename(const char *old, const char *new)
|
||||||
const char *fname = old;
|
const char *fname = old;
|
||||||
if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN))
|
if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN))
|
||||||
{
|
{
|
||||||
fname = _get_user_file_path(old, 0, realpath, sizeof(realpath));
|
fname = _get_user_file_path(old, NEED_WRITE, realpath, sizeof(realpath));
|
||||||
}
|
}
|
||||||
return rename(fname, new);
|
return rename(fname, new);
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +194,7 @@ int app_mkdir(const char* name)
|
||||||
const char *fname = name;
|
const char *fname = name;
|
||||||
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
||||||
{
|
{
|
||||||
fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
|
fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath));
|
||||||
}
|
}
|
||||||
return mkdir(fname);
|
return mkdir(fname);
|
||||||
}
|
}
|
||||||
|
|
@ -204,8 +205,7 @@ int app_rmdir(const char* name)
|
||||||
const char *fname = name;
|
const char *fname = name;
|
||||||
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
|
||||||
{
|
{
|
||||||
fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
|
fname = _get_user_file_path(name, NEED_WRITE, realpath, sizeof(realpath));
|
||||||
}
|
}
|
||||||
return rmdir(fname);
|
return rmdir(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue