summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings.c')
-rw-r--r--apps/settings.c21
1 files changed, 13 insertions, 8 deletions
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 **/
1214void set_file(const char* filename, char* setting, const int maxlen) 1219void 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);