summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-05 14:31:00 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-05 14:31:00 +0000
commit458b55dac69f63c434fcc78ba3c344afbbad1abb (patch)
tree599c8636250dc7ccbac08c8a630b9752678283e8 /apps/settings.c
parentf3a6d2476ace189048f1e5e91fd065dd5747c909 (diff)
downloadrockbox-458b55dac69f63c434fcc78ba3c344afbbad1abb.tar.gz
rockbox-458b55dac69f63c434fcc78ba3c344afbbad1abb.zip
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
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 5a61e6db53..3a851df0ff 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -342,11 +342,8 @@ bool settings_load_config(const char* file, bool apply)
342 char storage[MAX_PATH]; 342 char storage[MAX_PATH];
343 if (settings[i].filename_setting->prefix) 343 if (settings[i].filename_setting->prefix)
344 { 344 {
345 char prefix_dir[MAX_PATH]; 345 const char *dir = settings[i].filename_setting->prefix;
346 const char *dir = get_user_file_path( 346 size_t len = strlen(dir);
347 settings[i].filename_setting->prefix,
348 0, prefix_dir, sizeof(prefix_dir));
349 int len = strlen(dir);
350 if (!strncasecmp(value, dir, len)) 347 if (!strncasecmp(value, dir, len))
351 { 348 {
352 strlcpy(storage, &value[len], MAX_PATH); 349 strlcpy(storage, &value[len], MAX_PATH);
@@ -480,10 +477,6 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
480 if (((char*)settings[i].setting)[0] 477 if (((char*)settings[i].setting)[0]
481 && settings[i].filename_setting->prefix) 478 && settings[i].filename_setting->prefix)
482 { 479 {
483 char path[MAX_PATH];
484 const char *prefix = get_user_file_path(
485 settings[i].filename_setting->prefix, 0,
486 path, sizeof(path));
487 if (((char*)settings[i].setting)[0] == '-') 480 if (((char*)settings[i].setting)[0] == '-')
488 { 481 {
489 buf[0] = '-'; 482 buf[0] = '-';
@@ -491,7 +484,8 @@ bool cfg_to_string(int i/*setting_id*/, char* buf, int buf_len)
491 } 484 }
492 else 485 else
493 { 486 {
494 snprintf(buf,buf_len,"%s%s%s", prefix, 487 snprintf(buf,buf_len,"%s%s%s",
488 settings[i].filename_setting->prefix,
495 (char*)settings[i].setting, 489 (char*)settings[i].setting,
496 settings[i].filename_setting->suffix); 490 settings[i].filename_setting->suffix);
497 } 491 }