A few post-fixes to the get_user_file_path() commit.

Remove unneeded restriction from set_file that prevented filename settings to
work if they were outside of ROCKBOX_DIR.
Add the get_user_file_path() call to a few further places where it was
forgotten.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27667 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 67a4c17..28a2da6 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -182,14 +182,15 @@
  * load a colors file from a theme with:
  * filetype colours: filename.colours */
 void read_color_theme_file(void) {
-    char buffer[MAX_PATH];
+    char buffer[MAX_PATH], dir[MAX_PATH];
     int fd;
     char *ext, *color;
     int i;
     for (i = 0; i < MAX_FILETYPES+1; i++) {
         custom_colors[i] = -1;
     }
-    snprintf(buffer, MAX_PATH, "%s/%s.colours", THEME_DIR, 
+    snprintf(buffer, MAX_PATH, "%s/%s.colours",
+             get_user_file_path(THEME_DIR, 0, dir, sizeof(dir)),
              global_settings.colors_file);
     fd = open(buffer, O_RDONLY);
     if (fd < 0)
diff --git a/apps/settings.c b/apps/settings.c
index 58585d6..5a61e6d 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -886,10 +886,13 @@
     {
         char buf[MAX_PATH];
 #ifdef HAVE_LCD_BITMAP
+        char dir[MAX_PATH];
+        const char *font_path = get_user_file_path(FONT_DIR, 0, dir, sizeof(dir));
         /* fonts need to be loaded before the WPS */
         if (global_settings.font_file[0]
             && global_settings.font_file[0] != '-') {
-            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
+            
+            snprintf(buf, sizeof buf, "%s/%s.fnt", font_path,
                      global_settings.font_file);
             CHART2(">font_load ", global_settings.font_file);
             rc = font_load(NULL, buf);
@@ -902,7 +905,7 @@
 #ifdef HAVE_REMOTE_LCD        
         if ( global_settings.remote_font_file[0]
             && global_settings.remote_font_file[0] != '-') {
-            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
+            snprintf(buf, sizeof buf, "%s/%s.fnt", font_path,
                      global_settings.remote_font_file);
             CHART2(">font_load_remoteui ", global_settings.remote_font_file);
             rc = font_load_remoteui(buf);
@@ -914,7 +917,8 @@
             font_load_remoteui(NULL);
 #endif
         if ( global_settings.kbd_file[0]) {
-            snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
+            snprintf(buf, sizeof buf, "%s/%s.kbd",
+                     get_user_file_path(ROCKBOX_DIR, 0, dir, sizeof(dir)),
                      global_settings.kbd_file);
             CHART(">load_kbd");
             load_kbd(buf);
@@ -922,8 +926,9 @@
         }
         else
             load_kbd(NULL);
-#endif
-
+#endif /* HAVE_LCD_BITMAP */
+        /* no get_user_file_path() here because we don't really support
+         * langs that don't come with rockbox */
         if ( global_settings.lang_file[0]) {
             snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
                      global_settings.lang_file);
@@ -1208,8 +1213,8 @@
 }
 
 /*
- * Takes filename, removes the directory (assumed to be ROCKBOX_DIR) its in
- * and the extension, and then copies the basename into setting
+ * Takes filename, removes the directory and the extension,
+ * and then copies the basename into setting, unless the basename exceeds maxlen
  **/
 void set_file(const char* filename, char* setting, const int maxlen)
 {
@@ -1233,7 +1238,7 @@
     len = strlen(fptr) - extlen + 1;
 
     /* error if filename isn't in ROCKBOX_DIR */
-    if (strncasecmp(ROCKBOX_DIR, filename, ROCKBOX_DIR_LEN) || (len > maxlen))
+    if (len > maxlen)
         return;
 
     strlcpy(setting, fptr, len);
diff --git a/apps/tree.c b/apps/tree.c
index ed8e4d2..c2ec4ca 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -988,9 +988,10 @@
         /* If we've found a file to center on, do it */
         if (setting)
         {
-            char current[MAX_PATH];
+            char current[MAX_PATH], _dir[MAX_PATH];
             /* if setting != NULL, ext and dir are not used uninitialized */
-            snprintf(current, sizeof(current), "%s/%s.%s", dir, setting, ext);
+            snprintf(current, sizeof(current), "%s/%s.%s",
+                     get_user_file_path(dir, 0, _dir, sizeof(_dir)), setting, ext);
             set_current_file(current);
             /* set_current_file changes dirlevel, change it back */
             tc.dirlevel = 0;