summaryrefslogtreecommitdiff
path: root/rust/src/project.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-08-20 13:42:19 -0400
committerMason Reed <mason@vector35.com>2025-08-20 13:42:19 -0400
commit2ba29fd5fc09a78dd5e16a8706bbb8aa6468eb1d (patch)
treefff9d0278c348d3b19c3f928b5bac66e7fa570a3 /rust/src/project.rs
parentff72f3be107e94a0be41a1e7ba113000a4e95089 (diff)
[Rust] Add project path file retrieval related functions
Diffstat (limited to 'rust/src/project.rs')
-rw-r--r--rust/src/project.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/rust/src/project.rs b/rust/src/project.rs
index b2617cae..d276e532 100644
--- a/rust/src/project.rs
+++ b/rust/src/project.rs
@@ -575,6 +575,18 @@ impl Project {
Some(unsafe { ProjectFile::ref_from_raw(handle) })
}
+ /// Retrieve a list of files in the project by the `path` inside the project.
+ ///
+ /// Because a [`ProjectFile`] name is not unique, this returns a list instead of a single [`ProjectFile`].
+ pub fn files_by_path_in_project(&self, path: &Path) -> Array<ProjectFile> {
+ let path_raw = path.to_cstr();
+ let mut count = 0;
+ let result = unsafe {
+ BNProjectGetFilesByPathInProject(self.handle.as_ptr(), path_raw.as_ptr(), &mut count)
+ };
+ unsafe { Array::new(result, count, ()) }
+ }
+
/// Delete a file from the project
pub fn delete_file(&self, file: &ProjectFile) -> bool {
unsafe { BNProjectDeleteFile(self.handle.as_ptr(), file.handle.as_ptr()) }