summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Khosrowshahi <alexk@vector35.com>2025-08-13 23:48:11 -0700
committerAlexander Khosrowshahi <alexk@vector35.com>2025-08-14 10:36:22 -0700
commit89fc86ce91635ded0843e19e43c3a04c5e432836 (patch)
tree88f1387070566cf10f32897dbb45f330b2c3d44a
parentf85e56d1772a8bbaad259f201b604613818c0591 (diff)
Expose GetFilePathInProject API for context menu
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--project.cpp9
3 files changed, 11 insertions, 0 deletions
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<ProjectFile>& 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<ProjectFile>& file) const
+{
+ char* path = BNProjectGetFilePathInProject(m_object, file->m_object);
+ std::string result = path;
+ BNFreeString(path);
+ return result;
+}
+
+
std::string Project::GetName() const
{