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.

validate global_settings.start_directory on startup check for an ending slash and verify paths other than root exist

Change-Id: I4e1b3d51d99e5f5b66bcc0d66866ae35a554f84d

+25 -1
+1
apps/main.c
··· 241 241 #endif /* #ifdef AUTOROCK */ 242 242 243 243 global_status.last_volume_change = 0; 244 + validate_start_directory_init(); 244 245 /* no calls INIT_ATTR functions after this point anymore! 245 246 * see definition of INIT_ATTR in config.h */ 246 247 CHART(">root_menu");
+23
apps/misc.c
··· 2018 2018 } 2019 2019 } 2020 2020 2021 + void validate_start_directory_init(void) /* INIT_ATTR */ 2022 + { 2023 + char * const dirpath = global_settings.start_directory; 2024 + char *slash = strrchr(dirpath, PATH_SEPCH); 2025 + 2026 + if (!slash) 2027 + { 2028 + path_append(dirpath, PATH_ROOTSTR, PA_SEP_HARD, 2029 + sizeof(global_settings.start_directory)); 2030 + return; /* if this doesn't exist we have bigger issues */ 2031 + } 2032 + else if(slash[1] != '\0') /* ending slash required */ 2033 + { 2034 + path_append(dirpath, dirpath, PA_SEP_HARD, 2035 + sizeof(global_settings.start_directory)); 2036 + } 2037 + if (slash != dirpath && !dir_exists(dirpath)) 2038 + { 2039 + path_append(dirpath, PATH_ROOTSTR, 2040 + PA_SEP_HARD, sizeof(global_settings.start_directory)); 2041 + } 2042 + } 2043 + 2021 2044 #endif /* ndef __PCTOOL__ */
+1 -1
apps/misc.h
··· 128 128 long default_event_handler(long event); 129 129 bool list_stop_handler(void); 130 130 void car_adapter_mode_init(void) INIT_ATTR; 131 - 131 + void validate_start_directory_init(void) INIT_ATTR; 132 132 /* Unicode byte order mark sequences and lengths */ 133 133 #define BOM_UTF_8 "\xef\xbb\xbf" 134 134 #define BOM_UTF_8_SIZE 3