| 54 | } |
| 55 | |
| 56 | size_t SharedCacheBuilder::AddDirectory(const std::string& directoryPath) |
| 57 | { |
| 58 | // Filters then attempts to process a single directory entry as a shared cache file. |
| 59 | auto processDirEntry = [&](const std::filesystem::directory_entry& entry) { |
| 60 | const auto currentFilePath = entry.path().string(); |
| 61 | const auto currentFileName = BaseFileName(currentFilePath); |
| 62 | |
| 63 | // Skip non-files. |
| 64 | if (!entry.is_regular_file()) |
| 65 | return false; |
| 66 | |
| 67 | // Ok, we are now _sure_ that this file _might_ be a part of the cache, lets try and process it! |
| 68 | return AddFile(currentFilePath, currentFileName, CacheEntryType::Secondary); |
| 69 | }; |
| 70 | |
| 71 | // TODO: This is ugly. |
| 72 | size_t added = 0; |
| 73 | // Locate all possible related entry files and add them to the cache. |
| 74 | for (const auto& entry : std::filesystem::directory_iterator(directoryPath)) |
| 75 | if (processDirEntry(entry)) |
| 76 | added++; |
| 77 | return added; |
| 78 | } |
| 79 | |
| 80 | size_t SharedCacheBuilder::AddProjectFolder(Ref<ProjectFolder> folder) |
| 81 | { |
no test coverage detected