diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetypes.c | 5 | ||||
-rw-r--r-- | apps/settings.c | 21 | ||||
-rw-r--r-- | apps/tree.c | 5 |
3 files changed, 19 insertions, 12 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c index 67a4c176fb..28a2da65bb 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -182,14 +182,15 @@ static void read_config(const char* config_file); | |||
182 | * load a colors file from a theme with: | 182 | * load a colors file from a theme with: |
183 | * filetype colours: filename.colours */ | 183 | * filetype colours: filename.colours */ |
184 | void read_color_theme_file(void) { | 184 | void read_color_theme_file(void) { |
185 | char buffer[MAX_PATH]; | 185 | char buffer[MAX_PATH], dir[MAX_PATH]; |
186 | int fd; | 186 | int fd; |
187 | char *ext, *color; | 187 | char *ext, *color; |
188 | int i; | 188 | int i; |
189 | for (i = 0; i < MAX_FILETYPES+1; i++) { | 189 | for (i = 0; i < MAX_FILETYPES+1; i++) { |
190 | custom_colors[i] = -1; | 190 | custom_colors[i] = -1; |
191 | } | 191 | } |
192 | snprintf(buffer, MAX_PATH, "%s/%s.colours", THEME_DIR, | 192 | snprintf(buffer, MAX_PATH, "%s/%s.colours", |
193 | get_user_file_path(THEME_DIR, 0, dir, sizeof(dir)), | ||
193 | global_settings.colors_file); | 194 | global_settings.colors_file); |
194 | fd = open(buffer, O_RDONLY); | 195 | fd = open(buffer, O_RDONLY); |
195 | if (fd < 0) | 196 | if (fd < 0) |
diff --git a/apps/settings.c b/apps/settings.c index 58585d60e1..5a61e6db53 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -886,10 +886,13 @@ void settings_apply(bool read_disk) | |||
886 | { | 886 | { |
887 | char buf[MAX_PATH]; | 887 | char buf[MAX_PATH]; |
888 | #ifdef HAVE_LCD_BITMAP | 888 | #ifdef HAVE_LCD_BITMAP |
889 | char dir[MAX_PATH]; | ||
890 | const char *font_path = get_user_file_path(FONT_DIR, 0, dir, sizeof(dir)); | ||
889 | /* fonts need to be loaded before the WPS */ | 891 | /* fonts need to be loaded before the WPS */ |
890 | if (global_settings.font_file[0] | 892 | if (global_settings.font_file[0] |
891 | && global_settings.font_file[0] != '-') { | 893 | && global_settings.font_file[0] != '-') { |
892 | snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", | 894 | |
895 | snprintf(buf, sizeof buf, "%s/%s.fnt", font_path, | ||
893 | global_settings.font_file); | 896 | global_settings.font_file); |
894 | CHART2(">font_load ", global_settings.font_file); | 897 | CHART2(">font_load ", global_settings.font_file); |
895 | rc = font_load(NULL, buf); | 898 | rc = font_load(NULL, buf); |
@@ -902,7 +905,7 @@ void settings_apply(bool read_disk) | |||
902 | #ifdef HAVE_REMOTE_LCD | 905 | #ifdef HAVE_REMOTE_LCD |
903 | if ( global_settings.remote_font_file[0] | 906 | if ( global_settings.remote_font_file[0] |
904 | && global_settings.remote_font_file[0] != '-') { | 907 | && global_settings.remote_font_file[0] != '-') { |
905 | snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", | 908 | snprintf(buf, sizeof buf, "%s/%s.fnt", font_path, |
906 | global_settings.remote_font_file); | 909 | global_settings.remote_font_file); |
907 | CHART2(">font_load_remoteui ", global_settings.remote_font_file); | 910 | CHART2(">font_load_remoteui ", global_settings.remote_font_file); |
908 | rc = font_load_remoteui(buf); | 911 | rc = font_load_remoteui(buf); |
@@ -914,7 +917,8 @@ void settings_apply(bool read_disk) | |||
914 | font_load_remoteui(NULL); | 917 | font_load_remoteui(NULL); |
915 | #endif | 918 | #endif |
916 | if ( global_settings.kbd_file[0]) { | 919 | if ( global_settings.kbd_file[0]) { |
917 | snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", | 920 | snprintf(buf, sizeof buf, "%s/%s.kbd", |
921 | get_user_file_path(ROCKBOX_DIR, 0, dir, sizeof(dir)), | ||
918 | global_settings.kbd_file); | 922 | global_settings.kbd_file); |
919 | CHART(">load_kbd"); | 923 | CHART(">load_kbd"); |
920 | load_kbd(buf); | 924 | load_kbd(buf); |
@@ -922,8 +926,9 @@ void settings_apply(bool read_disk) | |||
922 | } | 926 | } |
923 | else | 927 | else |
924 | load_kbd(NULL); | 928 | load_kbd(NULL); |
925 | #endif | 929 | #endif /* HAVE_LCD_BITMAP */ |
926 | 930 | /* no get_user_file_path() here because we don't really support | |
931 | * langs that don't come with rockbox */ | ||
927 | if ( global_settings.lang_file[0]) { | 932 | if ( global_settings.lang_file[0]) { |
928 | snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", | 933 | snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", |
929 | global_settings.lang_file); | 934 | global_settings.lang_file); |
@@ -1208,8 +1213,8 @@ bool set_option(const char* string, const void* variable, enum optiontype type, | |||
1208 | } | 1213 | } |
1209 | 1214 | ||
1210 | /* | 1215 | /* |
1211 | * Takes filename, removes the directory (assumed to be ROCKBOX_DIR) its in | 1216 | * Takes filename, removes the directory and the extension, |
1212 | * and the extension, and then copies the basename into setting | 1217 | * and then copies the basename into setting, unless the basename exceeds maxlen |
1213 | **/ | 1218 | **/ |
1214 | void set_file(const char* filename, char* setting, const int maxlen) | 1219 | void set_file(const char* filename, char* setting, const int maxlen) |
1215 | { | 1220 | { |
@@ -1233,7 +1238,7 @@ void set_file(const char* filename, char* setting, const int maxlen) | |||
1233 | len = strlen(fptr) - extlen + 1; | 1238 | len = strlen(fptr) - extlen + 1; |
1234 | 1239 | ||
1235 | /* error if filename isn't in ROCKBOX_DIR */ | 1240 | /* error if filename isn't in ROCKBOX_DIR */ |
1236 | if (strncasecmp(ROCKBOX_DIR, filename, ROCKBOX_DIR_LEN) || (len > maxlen)) | 1241 | if (len > maxlen) |
1237 | return; | 1242 | return; |
1238 | 1243 | ||
1239 | strlcpy(setting, fptr, len); | 1244 | strlcpy(setting, fptr, len); |
diff --git a/apps/tree.c b/apps/tree.c index ed8e4d20bd..c2ec4ca3ec 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -988,9 +988,10 @@ int rockbox_browse(const char *root, int dirfilter) | |||
988 | /* If we've found a file to center on, do it */ | 988 | /* If we've found a file to center on, do it */ |
989 | if (setting) | 989 | if (setting) |
990 | { | 990 | { |
991 | char current[MAX_PATH]; | 991 | char current[MAX_PATH], _dir[MAX_PATH]; |
992 | /* if setting != NULL, ext and dir are not used uninitialized */ | 992 | /* if setting != NULL, ext and dir are not used uninitialized */ |
993 | snprintf(current, sizeof(current), "%s/%s.%s", dir, setting, ext); | 993 | snprintf(current, sizeof(current), "%s/%s.%s", |
994 | get_user_file_path(dir, 0, _dir, sizeof(_dir)), setting, ext); | ||
994 | set_current_file(current); | 995 | set_current_file(current); |
995 | /* set_current_file changes dirlevel, change it back */ | 996 | /* set_current_file changes dirlevel, change it back */ |
996 | tc.dirlevel = 0; | 997 | tc.dirlevel = 0; |