summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-07 12:08:37 -0400
committerMason Reed <mason@vector35.com>2025-04-07 12:08:42 -0400
commit840ae5356fe413049f77afbcb67c027366bdf0f0 (patch)
tree503f21dcf0f11a9690d0d6f3cde99cb242492865 /view/sharedcache/core/SharedCache.cpp
parent0945682aac233888d5b9c3211a682d332ecbeb21 (diff)
[SharedCache] Resolve original file path and name from project database file
Fixes https://github.com/Vector35/binaryninja-api/issues/6582 More considerations might need to be made for databases saved without the original file path. Likely solved through some shared cache specific metadata.
Diffstat (limited to 'view/sharedcache/core/SharedCache.cpp')
-rw-r--r--view/sharedcache/core/SharedCache.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index e468b559..bfb10d90 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -616,9 +616,11 @@ bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
auto baseProjectFile = m_view->GetFile()->GetProjectFile();
std::string baseFilePath = baseProjectFile->GetPathOnDisk();
std::string baseFileName = baseProjectFile->GetName();
+ // This will point to the path on disk for original non-bndb file.
+ std::string originalFilePath = m_view->GetFile()->GetOriginalFilename();
// 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: This is a little annoying, we need to do this because the file accessor we have is separate
// 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)
@@ -629,10 +631,11 @@ bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
{
auto projectFilePath = projectFile->GetPathOnDisk();
auto projectFileName = projectFile->GetName();
- if (projectFileName == baseFileName)
+ if (projectFileName == baseFileName || projectFilePath == originalFilePath)
{
// Use the real file instead.
baseFilePath = projectFilePath;
+ baseFileName = projectFileName;
baseProjectFile = projectFile;
break;
}