MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / get_file_by_id

Method get_file_by_id

rust/src/collaboration/project.rs:233–243  ·  view source on GitHub ↗

Get a specific File in the Project by its id NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If files have not been pulled, they will be pulled upon calling this.

(&self, id: S)

Source from the content-addressed store, hash-verified

231 /// NOTE: If the project has not been opened, it will be opened upon calling this.
232 /// NOTE: If files have not been pulled, they will be pulled upon calling this.
233 pub fn get_file_by_id<S: BnStrCompatible>(&self, id: S) -> Result<Option<Ref<RemoteFile>>, ()> {
234 // TODO: This sync should be removed?
235 if !self.has_pulled_files() {
236 self.pull_files()?;
237 }
238 let id = id.into_bytes_with_nul();
239 let result = unsafe {
240 BNRemoteProjectGetFileById(self.handle.as_ptr(), id.as_ref().as_ptr() as *const c_char)
241 };
242 Ok(NonNull::new(result).map(|handle| unsafe { RemoteFile::ref_from_raw(handle) }))
243 }
244
245 /// Get a specific File in the Project by its name
246 ///

Callers 2

test_project_creationFunction · 0.45
test_project_syncFunction · 0.45

Calls 5

into_bytes_with_nulMethod · 0.80
mapMethod · 0.80
has_pulled_filesMethod · 0.45
pull_filesMethod · 0.45
as_refMethod · 0.45

Tested by 2

test_project_creationFunction · 0.36
test_project_syncFunction · 0.36