| 422 | } |
| 423 | |
| 424 | static bool FilterMatches(const std::string_view fileName, const std::string_view filter) |
| 425 | { |
| 426 | std::string_view::size_type start = 0; |
| 427 | std::string_view::size_type len = filter.length(); |
| 428 | while (start < len) |
| 429 | { |
| 430 | std::string_view::size_type end = filter.find('/', start); |
| 431 | if (end == std::string_view::npos) |
| 432 | { |
| 433 | end = len; |
| 434 | } |
| 435 | |
| 436 | std::string_view singleFilter(filter.substr(start, end - start)); |
| 437 | if (fileName.find(singleFilter) != std::string_view::npos) |
| 438 | { |
| 439 | return true; |
| 440 | } |
| 441 | |
| 442 | start = end + 1; |
| 443 | } |
| 444 | |
| 445 | return false; |
| 446 | } |
| 447 | |
| 448 | bool FolderMemoryCard::AddFolder(MemoryCardFileEntry* const dirEntry, const std::string& dirPath, MemoryCardFileMetadataReference* parent /* = nullptr */, const bool enableFiltering /* = false */, const std::string_view filter /* = "" */) |
| 449 | { |