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

Method get_file_by_name

rust/src/collaboration/project.rs:249–265  ·  view source on GitHub ↗

Get a specific File in the Project by its name 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,
        name: S,
    )

Source from the content-addressed store, hash-verified

247 /// NOTE: If the project has not been opened, it will be opened upon calling this.
248 /// NOTE: If files have not been pulled, they will be pulled upon calling this.
249 pub fn get_file_by_name<S: BnStrCompatible>(
250 &self,
251 name: S,
252 ) -> Result<Option<Ref<RemoteFile>>, ()> {
253 // TODO: This sync should be removed?
254 if !self.has_pulled_files() {
255 self.pull_files()?;
256 }
257 let id = name.into_bytes_with_nul();
258 let result = unsafe {
259 BNRemoteProjectGetFileByName(
260 self.handle.as_ptr(),
261 id.as_ref().as_ptr() as *const c_char,
262 )
263 };
264 Ok(NonNull::new(result).map(|handle| unsafe { RemoteFile::ref_from_raw(handle) }))
265 }
266
267 /// Pull the list of files from the Remote.
268 ///

Callers

nothing calls this directly

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

no test coverage detected