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

Method create_file_from_path_with_progress

rust/src/project.rs:373–404  ·  view source on GitHub ↗

Create a file in the project from a path on disk `path` - Path on disk `folder` - Folder to place the created file in `name` - Name to assign to the created file `description` - Description to assign to the created file `progress` - [`ProgressCallback`] that will be called as the [`ProjectFile`] is being added

(
        &self,
        path: P,
        folder: Option<&ProjectFolder>,
        name: N,
        description: D,
        mut progress: PC,
    )

Source from the content-addressed store, hash-verified

371 /// * `description` - Description to assign to the created file
372 /// * `progress` - [`ProgressCallback`] that will be called as the [`ProjectFile`] is being added
373 pub fn create_file_from_path_with_progress<P, N, D, PC>(
374 &self,
375 path: P,
376 folder: Option<&ProjectFolder>,
377 name: N,
378 description: D,
379 mut progress: PC,
380 ) -> Result<Ref<ProjectFile>, ()>
381 where
382 P: BnStrCompatible,
383 N: BnStrCompatible,
384 D: BnStrCompatible,
385 PC: ProgressCallback,
386 {
387 let path_raw = path.into_bytes_with_nul();
388 let name_raw = name.into_bytes_with_nul();
389 let description_raw = description.into_bytes_with_nul();
390 let folder_ptr = folder.map(|p| p.handle.as_ptr()).unwrap_or(null_mut());
391
392 unsafe {
393 let result = BNProjectCreateFileFromPath(
394 self.handle.as_ptr(),
395 path_raw.as_ref().as_ptr() as *const c_char,
396 folder_ptr,
397 name_raw.as_ref().as_ptr() as *const c_char,
398 description_raw.as_ref().as_ptr() as *const c_char,
399 &mut progress as *mut PC as *mut c_void,
400 Some(PC::cb_progress_callback),
401 );
402 Ok(ProjectFile::ref_from_raw(NonNull::new(result).ok_or(())?))
403 }
404 }
405
406 /// Create a file in the project from a path on disk
407 ///

Callers 2

create_file_from_pathMethod · 0.80
modify_projectFunction · 0.80

Calls 3

into_bytes_with_nulMethod · 0.80
mapMethod · 0.80
as_refMethod · 0.45

Tested by 1

modify_projectFunction · 0.64