Skip to content

Commit 89fc86c

Browse files
committed
Expose GetFilePathInProject API for context menu
1 parent f85e56d commit 89fc86c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

binaryninjaapi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,6 +3694,7 @@ namespace BinaryNinja {
36943694
std::string GetId() const;
36953695
bool IsOpen() const;
36963696
std::string GetPath() const;
3697+
std::string GetFilePathInProject(const Ref<ProjectFile>& file) const;
36973698
std::string GetName() const;
36983699
void SetName(const std::string& name);
36993700
std::string GetDescription() const;

binaryninjacore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4039,6 +4039,7 @@ extern "C"
40394039
BINARYNINJACOREAPI char* BNProjectGetId(BNProject* project);
40404040
BINARYNINJACOREAPI bool BNProjectIsOpen(BNProject* project);
40414041
BINARYNINJACOREAPI char* BNProjectGetPath(BNProject* project);
4042+
BINARYNINJACOREAPI char* BNProjectGetFilePathInProject(BNProject* project, BNProjectFile* file);
40424043
BINARYNINJACOREAPI char* BNProjectGetName(BNProject* project);
40434044
BINARYNINJACOREAPI void BNProjectSetName(BNProject* project, const char* name);
40444045
BINARYNINJACOREAPI char* BNProjectGetDescription(BNProject* project);

project.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ std::string Project::GetPath() const
285285
return result;
286286
}
287287

288+
std::string Project::GetFilePathInProject(const Ref<ProjectFile>& file) const
289+
{
290+
char* path = BNProjectGetFilePathInProject(m_object, file->m_object);
291+
std::string result = path;
292+
BNFreeString(path);
293+
return result;
294+
}
295+
296+
288297

289298
std::string Project::GetName() const
290299
{

0 commit comments

Comments
 (0)