| 268 | } |
| 269 | |
| 270 | int refreshFileList() { |
| 271 | int ret = 0, res = 0; |
| 272 | |
| 273 | // always sort recent files by date |
| 274 | char *contains = strstr(file_list.path, VITASHELL_RECENT_PATH); |
| 275 | if (contains) { |
| 276 | sort_mode = SORT_BY_DATE; |
| 277 | } else { |
| 278 | sort_mode = last_set_sort_mode; |
| 279 | } |
| 280 | |
| 281 | do { |
| 282 | fileListEmpty(&file_list); |
| 283 | |
| 284 | res = fileListGetEntries(&file_list, file_list.path, sort_mode); |
| 285 | |
| 286 | if (res < 0) { |
| 287 | ret = res; |
| 288 | dirUp(); |
| 289 | } |
| 290 | } while (res < 0); |
| 291 | |
| 292 | // Position correction |
| 293 | if (file_list.length >= MAX_POSITION) { |
| 294 | if ((base_pos + rel_pos) >= file_list.length) { |
| 295 | rel_pos = MAX_POSITION - 1; |
| 296 | } |
| 297 | |
| 298 | if ((base_pos + MAX_POSITION - 1) >= file_list.length) { |
| 299 | base_pos = file_list.length - MAX_POSITION; |
| 300 | } |
| 301 | } else { |
| 302 | if ((base_pos + rel_pos) >= file_list.length) { |
| 303 | rel_pos = file_list.length - 1; |
| 304 | } |
| 305 | |
| 306 | base_pos = 0; |
| 307 | } |
| 308 | |
| 309 | return ret; |
| 310 | } |
| 311 | |
| 312 | static void refreshMarkList() { |
| 313 | if (isInArchive()) |
no test coverage detected