One more get_user_file_path() fix. Don't store the user dir in config.cfg and
pretent the file (fonts, wps, etc.)was in the installation dir (it'll still be loaded from the user dir). This way the behavior is the same for files in the installation dir and in the user config dir. This is needed because we historically only store the basename of the file at runtime and don't support writing these to config.cfg if they're outside of the rockbox dir. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27720 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f3a6d2476a
commit
458b55dac6
1 changed files with 4 additions and 10 deletions
|
@ -342,11 +342,8 @@ bool settings_load_config(const char* file, bool apply)
|
||||||
char storage[MAX_PATH];
|
char storage[MAX_PATH];
|
||||||
if (settings[i].filename_setting->prefix)
|
if (settings[i].filename_setting->prefix)
|
||||||
{
|
{
|
||||||
char prefix_dir[MAX_PATH];
|
const char *dir = settings[i].filename_setting->prefix;
|
||||||
const char *dir = get_user_file_path(
|
size_t len = strlen(dir);
|
||||||
settings[i].filename_setting->prefix,
|
|
||||||
0, prefix_dir, sizeof(prefix_dir));
|
|
||||||
int len = strlen(dir);
|
|
||||||
if (!strncasecmp(value, dir, len))
|
if (!strncasecmp(value, dir, len))
|
||||||
{
|
{
|
||||||
strlcpy(storage, &value[len], MAX_PATH);
|
strlcpy(storage, &value[len], MAX_PATH);
|
||||||
|
@ -480,10 +477,6 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
|
||||||
if (((char*)settings[i].setting)[0]
|
if (((char*)settings[i].setting)[0]
|
||||||
&& settings[i].filename_setting->prefix)
|
&& settings[i].filename_setting->prefix)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
|
||||||
const char *prefix = get_user_file_path(
|
|
||||||
settings[i].filename_setting->prefix, 0,
|
|
||||||
path, sizeof(path));
|
|
||||||
if (((char*)settings[i].setting)[0] == '-')
|
if (((char*)settings[i].setting)[0] == '-')
|
||||||
{
|
{
|
||||||
buf[0] = '-';
|
buf[0] = '-';
|
||||||
|
@ -491,7 +484,8 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(buf,buf_len,"%s%s%s", prefix,
|
snprintf(buf,buf_len,"%s%s%s",
|
||||||
|
settings[i].filename_setting->prefix,
|
||||||
(char*)settings[i].setting,
|
(char*)settings[i].setting,
|
||||||
settings[i].filename_setting->suffix);
|
settings[i].filename_setting->suffix);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue