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

Method create_file_from_path

python/project.py:563–587  ·  view source on GitHub ↗

Create a file in the project from a path on disk :param path: Path on disk :param folder: Folder to place the created file in :param name: Name to assign to the created file :param description: Description to assign to the created file :param progress_func: Progress function that will

(self, path: AsPath, folder: Optional[ProjectFile], name: str, description: str = "", progress_func: ProgressFuncType = _nop)

Source from the content-addressed store, hash-verified

561 return core.BNProjectDeleteFolder(self._handle, folder._handle, None, _wrap_progress(progress_func))
562
563 def create_file_from_path(self, path: AsPath, folder: Optional[ProjectFile], name: str, description: str = "", progress_func: ProgressFuncType = _nop) -> ProjectFile:
564 """
565 Create a file in the project from a path on disk
566
567 :param path: Path on disk
568 :param folder: Folder to place the created file in
569 :param name: Name to assign to the created file
570 :param description: Description to assign to the created file
571 :param progress_func: Progress function that will be called as the file is being added
572 """
573 folder_handle = folder._handle if folder is not None else None
574 file_handle = core.BNProjectCreateFileFromPath(
575 project=self._handle,
576 path=str(path),
577 folder=folder_handle,
578 name=name,
579 description=description,
580 ctxt=None,
581 progress=_wrap_progress(progress_func)
582 )
583
584 if file_handle is None:
585 raise ProjectException("Failed to create file")
586
587 return ProjectFile(handle=file_handle)
588
589 def create_file(self, contents: bytes, folder: Optional[ProjectFile], name: str, description: str = "", progress_func: ProgressFuncType = _nop) -> ProjectFile:
590 """

Callers

nothing calls this directly

Calls 3

_wrap_progressFunction · 0.85
ProjectExceptionClass · 0.70
ProjectFileClass · 0.70

Tested by

no test coverage detected