From 89fc86ce91635ded0843e19e43c3a04c5e432836 Mon Sep 17 00:00:00 2001 From: Alexander Khosrowshahi Date: Wed, 13 Aug 2025 23:48:11 -0700 Subject: Expose GetFilePathInProject API for context menu --- binaryninjaapi.h | 1 + binaryninjacore.h | 1 + project.cpp | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 32d6051f..93117eb8 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -3694,6 +3694,7 @@ namespace BinaryNinja { std::string GetId() const; bool IsOpen() const; std::string GetPath() const; + std::string GetFilePathInProject(const Ref& file) const; std::string GetName() const; void SetName(const std::string& name); std::string GetDescription() const; diff --git a/binaryninjacore.h b/binaryninjacore.h index b7f9e63a..ae935420 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -4039,6 +4039,7 @@ extern "C" BINARYNINJACOREAPI char* BNProjectGetId(BNProject* project); BINARYNINJACOREAPI bool BNProjectIsOpen(BNProject* project); BINARYNINJACOREAPI char* BNProjectGetPath(BNProject* project); + BINARYNINJACOREAPI char* BNProjectGetFilePathInProject(BNProject* project, BNProjectFile* file); BINARYNINJACOREAPI char* BNProjectGetName(BNProject* project); BINARYNINJACOREAPI void BNProjectSetName(BNProject* project, const char* name); BINARYNINJACOREAPI char* BNProjectGetDescription(BNProject* project); diff --git a/project.cpp b/project.cpp index e795db61..e3e2b923 100644 --- a/project.cpp +++ b/project.cpp @@ -285,6 +285,15 @@ std::string Project::GetPath() const return result; } +std::string Project::GetFilePathInProject(const Ref& file) const +{ + char* path = BNProjectGetFilePathInProject(m_object, file->m_object); + std::string result = path; + BNFreeString(path); + return result; +} + + std::string Project::GetName() const { -- cgit v1.3.1