summaryrefslogtreecommitdiff
path: root/project.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project.cpp')
-rw-r--r--project.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/project.cpp b/project.cpp
index 6cb76a02..e795db61 100644
--- a/project.cpp
+++ b/project.cpp
@@ -477,7 +477,7 @@ Ref<ProjectFile> Project::GetFileById(const std::string& id) const
}
-Ref<ProjectFile> Project::GetFileByPathOnDisk(const std::string& path)
+Ref<ProjectFile> Project::GetFileByPathOnDisk(const std::string& path) const
{
BNProjectFile* file = BNProjectGetFileByPathOnDisk(m_object, path.c_str());
if (file == nullptr)
@@ -486,6 +486,25 @@ Ref<ProjectFile> Project::GetFileByPathOnDisk(const std::string& path)
}
+std::vector<Ref<ProjectFile>> Project::GetFilesByPathInProject(
+ const std::string& path
+) const
+{
+ size_t count;
+ BNProjectFile** files = BNProjectGetFilesByPathInProject(m_object, path.c_str(), &count);
+
+ std::vector<Ref<ProjectFile>> 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<ProjectFile> file)
{
BNProjectPushFile(m_object, file->m_object);