From 2be7b54b7bc7a0e46408b228ee55bbb4fe342e6c Mon Sep 17 00:00:00 2001 From: Alexander Khosrowshahi Date: Mon, 30 Jun 2025 14:56:41 -0400 Subject: Add GetPathInProject() to core API --- examples/triage/fileinfo.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/triage/fileinfo.cpp b/examples/triage/fileinfo.cpp index 3250feae..b521b892 100644 --- a/examples/triage/fileinfo.cpp +++ b/examples/triage/fileinfo.cpp @@ -72,9 +72,18 @@ FileInfoWidget::FileInfoWidget(QWidget* parent, BinaryViewRef bv) this->m_layout->setVerticalSpacing(1); const auto view = bv->GetParentView() ? bv->GetParentView() : bv; - const auto filePath = bv->GetFile()->GetOriginalFilename(); + + const auto file = bv->GetFile(); + const auto filePath = file->GetOriginalFilename(); this->addCopyableField("Path: ", filePath.c_str()); + // If triage view is opened from a project, show both actual filepath and path relative to project + if (const auto fileProjectRef = file->GetProjectFile()) + { + const auto projectFilePath = file->GetProjectFile()->GetPathInProject(); + this->addCopyableField("Path in project: ", projectFilePath.c_str()); + } + const auto fileSize = QString::number(view->GetLength(), 16).prepend("0x"); this->addCopyableField("Size: ", fileSize); -- cgit v1.3.1