From 533b8e546a00537d6945f5329decab4b74a5bf09 Mon Sep 17 00:00:00 2001 From: Alexander Khosrowshahi Date: Thu, 3 Jul 2025 13:53:40 -0400 Subject: Add get_files_by_path_in_project and get_path_in_project to C++ and python APIs --- project.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'project.cpp') diff --git a/project.cpp b/project.cpp index 6cb76a02..e795db61 100644 --- a/project.cpp +++ b/project.cpp @@ -477,7 +477,7 @@ Ref Project::GetFileById(const std::string& id) const } -Ref Project::GetFileByPathOnDisk(const std::string& path) +Ref Project::GetFileByPathOnDisk(const std::string& path) const { BNProjectFile* file = BNProjectGetFileByPathOnDisk(m_object, path.c_str()); if (file == nullptr) @@ -486,6 +486,25 @@ Ref Project::GetFileByPathOnDisk(const std::string& path) } +std::vector> Project::GetFilesByPathInProject( + const std::string& path +) const +{ + size_t count; + BNProjectFile** files = BNProjectGetFilesByPathInProject(m_object, path.c_str(), &count); + + std::vector> result; + result.reserve(count); + for (size_t i = 0; i < count; i++) + { + result.emplace_back(new ProjectFile(BNNewProjectFileReference(files[i]))); + } + + BNFreeProjectFileList(files, count); + return result; +} + + void Project::PushFile(Ref file) { BNProjectPushFile(m_object, file->m_object); -- cgit v1.3.1