Skip to content

Commit 6857114

Browse files
committed
Add shared cache dependencies to database on save
1 parent 1600760 commit 6857114

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

view/sharedcache/core/SharedCacheView.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,29 @@ void SharedCacheView::OnAfterSnapshotDataApplied()
989989
}
990990

991991

992+
void SharedCacheView::OnAfterSnapshotDataSaved()
993+
{
994+
auto projectFile = GetFile()->GetProjectFile();
995+
if (!projectFile)
996+
return;
997+
998+
auto project = projectFile->GetProject();
999+
auto projectFolder = projectFile->GetFolder();
1000+
1001+
std::set<std::string> dependencyFileNames = m_secondaryFileNames;
1002+
if (!m_primaryFileName.empty())
1003+
dependencyFileNames.insert(m_primaryFileName);
1004+
1005+
for (const auto& dependencyFile : project->GetFilesInFolder(projectFolder))
1006+
{
1007+
if (!dependencyFileNames.contains(dependencyFile->GetName()))
1008+
continue;
1009+
1010+
projectFile->AddDependency(dependencyFile);
1011+
}
1012+
}
1013+
1014+
9921015
void SharedCacheView::SetPrimaryFileName(std::string primaryFileName)
9931016
{
9941017
m_primaryFileName = std::move(primaryFileName);

view/sharedcache/core/SharedCacheView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SharedCacheView : public BinaryNinja::BinaryView
2626

2727
bool Init() override;
2828
void OnAfterSnapshotDataApplied() override;
29+
void OnAfterSnapshotDataSaved() override;
2930

3031
// Initialized the shared cache controller for this view. This is what allows us to load images and regions.
3132
bool InitController();

0 commit comments

Comments
 (0)