MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / AddDirectory

Method AddDirectory

view/sharedcache/core/SharedCacheBuilder.cpp:56–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56size_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
80size_t SharedCacheBuilder::AddProjectFolder(Ref<ProjectFolder> folder)
81{

Callers 1

InitControllerMethod · 0.80

Calls 3

BaseFileNameFunction · 0.85
stringMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected