Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+19 -12
+3 -2
apps/filetypes.c
··· 182 182 * load a colors file from a theme with: 183 183 * filetype colours: filename.colours */ 184 184 void read_color_theme_file(void) { 185 - char buffer[MAX_PATH]; 185 + char buffer[MAX_PATH], dir[MAX_PATH]; 186 186 int fd; 187 187 char *ext, *color; 188 188 int i; 189 189 for (i = 0; i < MAX_FILETYPES+1; i++) { 190 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 194 global_settings.colors_file); 194 195 fd = open(buffer, O_RDONLY); 195 196 if (fd < 0)
+13 -8
apps/settings.c
··· 886 886 { 887 887 char buf[MAX_PATH]; 888 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 891 /* fonts need to be loaded before the WPS */ 890 892 if (global_settings.font_file[0] 891 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 896 global_settings.font_file); 894 897 CHART2(">font_load ", global_settings.font_file); 895 898 rc = font_load(NULL, buf); ··· 902 905 #ifdef HAVE_REMOTE_LCD 903 906 if ( global_settings.remote_font_file[0] 904 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 909 global_settings.remote_font_file); 907 910 CHART2(">font_load_remoteui ", global_settings.remote_font_file); 908 911 rc = font_load_remoteui(buf); ··· 914 917 font_load_remoteui(NULL); 915 918 #endif 916 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 922 global_settings.kbd_file); 919 923 CHART(">load_kbd"); 920 924 load_kbd(buf); ··· 922 926 } 923 927 else 924 928 load_kbd(NULL); 925 - #endif 926 - 929 + #endif /* HAVE_LCD_BITMAP */ 930 + /* no get_user_file_path() here because we don't really support 931 + * langs that don't come with rockbox */ 927 932 if ( global_settings.lang_file[0]) { 928 933 snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", 929 934 global_settings.lang_file); ··· 1208 1213 } 1209 1214 1210 1215 /* 1211 - * Takes filename, removes the directory (assumed to be ROCKBOX_DIR) its in 1212 - * and the extension, and then copies the basename into setting 1216 + * Takes filename, removes the directory and the extension, 1217 + * and then copies the basename into setting, unless the basename exceeds maxlen 1213 1218 **/ 1214 1219 void set_file(const char* filename, char* setting, const int maxlen) 1215 1220 { ··· 1233 1238 len = strlen(fptr) - extlen + 1; 1234 1239 1235 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 1242 return; 1238 1243 1239 1244 strlcpy(setting, fptr, len);
+3 -2
apps/tree.c
··· 988 988 /* If we've found a file to center on, do it */ 989 989 if (setting) 990 990 { 991 - char current[MAX_PATH]; 991 + char current[MAX_PATH], _dir[MAX_PATH]; 992 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 995 set_current_file(current); 995 996 /* set_current_file changes dirlevel, change it back */ 996 997 tc.dirlevel = 0;