summaryrefslogtreecommitdiff
path: root/view/sharedcache/core
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-03-31 17:23:25 -0400
committerMason Reed <mason@vector35.com>2025-04-02 05:36:54 -0400
commit7d8fab3ca667ea727becce31ce605d932c8784ed (patch)
tree9af589ecf6fcb4f1055d875c4ea628ab62dfc0f0 /view/sharedcache/core
parent25cc02431b61097b2adfc2fbc493b648b0300c3b (diff)
[SharedCache] Fix some issues with project loading
Diffstat (limited to 'view/sharedcache/core')
-rw-r--r--view/sharedcache/core/SharedCache.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index 24bc4619..56d2040d 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -542,6 +542,9 @@ bool CacheProcessor::ProcessFileCache(SharedCache& cache)
// Skip map files, they contain some nice information... we don't use.
if (entry.path().extension() == ".map")
continue;
+ // Skip bndb files!
+ if (entry.path().extension() == ".bndb")
+ continue;
try
{
auto additionalEntry = CacheEntry::FromFile(currentFilePath, currentFileName, CacheEntryType::Secondary);
@@ -565,8 +568,29 @@ bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
{
auto baseProjectFile = m_view->GetFile()->GetProjectFile();
std::string baseFilePath = baseProjectFile->GetPathOnDisk();
- // TODO: I dont think the project file name will have anything other than the base name so this might be redundant.
- std::string baseFileName = BaseFileName(baseProjectFile->GetName());
+ std::string baseFileName = baseProjectFile->GetName();
+
+ // Remove the .bndb extension if present ("dyld_shared_cache_arm64e.bndb" => "dyld_shared_cache_arm64e)
+ // TODO: This is a little annoying, we need to do this because the file accessor we have is seperate
+ // TODO: from the view file accessor. If we either made it so that we can parse from the BNDB file accessor,
+ // TODO: or... something better than this.
+ if (baseFileName.find(".bndb") != std::string::npos)
+ {
+ baseFileName = baseFileName.substr(0, baseFileName.size() - 5);
+ // Search for the backing file.
+ for (const auto& projectFile : baseProjectFile->GetProject()->GetFiles())
+ {
+ auto projectFilePath = projectFile->GetPathOnDisk();
+ auto projectFileName = projectFile->GetName();
+ if (projectFileName == baseFileName)
+ {
+ // Use the real file instead.
+ baseFilePath = projectFilePath;
+ baseProjectFile = projectFile;
+ break;
+ }
+ }
+ }
// Add this file to the entries
auto baseEntry = CacheEntry::FromFile(baseFilePath, baseFileName, CacheEntryType::Primary);
@@ -593,6 +617,9 @@ bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
// Filter out .map files, they contain some nice info for rebasing... that we don't do.
if (projectFileName.find(".map") != std::string::npos)
continue;
+ // Filter out .bndb files!
+ if (projectFileName.find(".bndb") != std::string::npos)
+ continue;
// If both top level, or we are in the same folder as the base project file add it.
if ((!folder && !currentFolder) || (folder && currentFolder))
{