From 89fc86ce91635ded0843e19e43c3a04c5e432836 Mon Sep 17 00:00:00 2001 From: Alexander Khosrowshahi Date: Wed, 13 Aug 2025 23:48:11 -0700 Subject: [PATCH 1/2] 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 32d6051f1b..93117eb8ff 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 b7f9e63a65..ae935420ce 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 e795db619f..e3e2b923ca 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 { From ce38990dae2d88d96793715d40544c7e5ece524d Mon Sep 17 00:00:00 2001 From: Alexander Khosrowshahi Date: Thu, 14 Aug 2025 10:41:29 -0700 Subject: [PATCH 2/2] Bump CURRENT_CORE_ABI_VERSION for GetFilePathInProject --- binaryninjacore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryninjacore.h b/binaryninjacore.h index ae935420ce..47f47905cf 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -37,7 +37,7 @@ // Current ABI version for linking to the core. This is incremented any time // there are changes to the API that affect linking, including new functions, // new types, or modifications to existing functions or types. -#define BN_CURRENT_CORE_ABI_VERSION 128 +#define BN_CURRENT_CORE_ABI_VERSION 129 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and