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

Method AddFile

view/sharedcache/core/SharedCacheBuilder.cpp:22–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22bool SharedCacheBuilder::AddFile(
23 const std::string& filePath, const std::string& fileName, const CacheEntryType cacheType)
24{
25 // Skip already processed files.
26 if (auto [_, inserted] = m_processedFiles.insert(filePath); !inserted)
27 return false;
28 // We only want to process files containing the base file name.
29 if (fileName.find(m_primaryFileName) == std::string::npos)
30 return false;
31 // Skip map files, they contain some nice information... we don't use.
32 if (fileName.find(".map") != std::string::npos)
33 return false;
34 // Skip atlas files, they contain some nice information... we don't use.
35 if (fileName.find(".atlas") != std::string::npos)
36 return false;
37 // Skip bndb files!
38 if (fileName.find(".bndb") != std::string::npos)
39 return false;
40
41 try
42 {
43 auto entry = CacheEntry::FromFile(filePath, fileName, cacheType);
44 m_cache.AddEntry(std::move(entry));
45 }
46 catch (const std::exception& e)
47 {
48 // Just return false so the view init can continue.
49 m_logger->LogErrorF("Failed to add file '{}': {}", fileName, e.what());
50 return false;
51 }
52
53 return true;
54}
55
56size_t SharedCacheBuilder::AddDirectory(const std::string& directoryPath)
57{

Callers 1

InitControllerMethod · 0.80

Calls 5

findMethod · 0.80
AddEntryMethod · 0.80
LogErrorFMethod · 0.80
insertMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected