diff options
| -rw-r--r-- | binaryninjaapi.h | 4 | ||||
| -rw-r--r-- | binaryninjacore.h | 8 | ||||
| -rw-r--r-- | project.cpp | 8 | ||||
| -rw-r--r-- | python/project.py | 10 |
4 files changed, 16 insertions, 14 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 55fd672c..c9804c25 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -2674,7 +2674,7 @@ namespace BinaryNinja { std::vector<Ref<ProjectFolder>> GetFolders() const; Ref<ProjectFolder> GetFolderById(const std::string& id) const; void PushFolder(Ref<ProjectFolder> folder); - void DeleteFolder(Ref<ProjectFolder> folder, const std::function<bool(size_t progress, size_t total)>& progressCallback = {}); + bool DeleteFolder(Ref<ProjectFolder> folder, const std::function<bool(size_t progress, size_t total)>& progressCallback = {}); Ref<ProjectFile> CreateFileFromPath(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::function<bool(size_t progress, size_t total)>& progressCallback = {}); Ref<ProjectFile> CreateFileFromPathUnsafe(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, int64_t creationTimestamp, const std::function<bool(size_t progress, size_t total)>& progressCallback = {}); @@ -2684,7 +2684,7 @@ namespace BinaryNinja { Ref<ProjectFile> GetFileById(const std::string& id) const; Ref<ProjectFile> GetFileByPathOnDisk(const std::string& path); void PushFile(Ref<ProjectFile> file); - void DeleteFile_(Ref<ProjectFile> file); + bool DeleteFile_(Ref<ProjectFile> file); void RegisterNotification(ProjectNotification* notify); void UnregisterNotification(ProjectNotification* notify); diff --git a/binaryninjacore.h b/binaryninjacore.h index 2c010328..92bd8a55 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -37,14 +37,14 @@ // Current ABI version for linking to the core. This is incremented any time // there are changes to the API that affect linking, including new functions, // new types, or modifications to existing functions or types. -#define BN_CURRENT_CORE_ABI_VERSION 52 +#define BN_CURRENT_CORE_ABI_VERSION 53 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and // will require rebuilding. The minimum version is increased when there are // incompatible changes that break binary compatibility, such as changes to // existing types or functions. -#define BN_MINIMUM_CORE_ABI_VERSION 52 +#define BN_MINIMUM_CORE_ABI_VERSION 53 #ifdef __GNUC__ #ifdef BINARYNINJACORE_LIBRARY @@ -3405,7 +3405,7 @@ extern "C" BINARYNINJACOREAPI BNProjectFile* BNProjectGetFileByPathOnDisk(BNProject* project, const char* path); BINARYNINJACOREAPI void BNProjectPushFile(BNProject* project, BNProjectFile* file); - BINARYNINJACOREAPI void BNProjectDeleteFile(BNProject* project, BNProjectFile* file); + BINARYNINJACOREAPI bool BNProjectDeleteFile(BNProject* project, BNProjectFile* file); BINARYNINJACOREAPI BNProjectFolder* BNProjectCreateFolderFromPath(BNProject* project, const char* path, BNProjectFolder* parent, const char* description, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total)); @@ -3414,7 +3414,7 @@ extern "C" BINARYNINJACOREAPI BNProjectFolder** BNProjectGetFolders(BNProject* project, size_t* count); BINARYNINJACOREAPI BNProjectFolder* BNProjectGetFolderById(BNProject* project, const char* id); BINARYNINJACOREAPI void BNProjectPushFolder(BNProject* project, BNProjectFolder* folder); - BINARYNINJACOREAPI void BNProjectDeleteFolder(BNProject* project, BNProjectFolder* folder, void* ctxt, + BINARYNINJACOREAPI bool BNProjectDeleteFolder(BNProject* project, BNProjectFolder* folder, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total)); BINARYNINJACOREAPI void BNProjectBeginBulkOperation(BNProject* project); diff --git a/project.cpp b/project.cpp index 018b6e14..54e873dc 100644 --- a/project.cpp +++ b/project.cpp @@ -399,11 +399,11 @@ void Project::PushFolder(Ref<ProjectFolder> folder) } -void Project::DeleteFolder(Ref<ProjectFolder> folder, const std::function<bool(size_t progress, size_t total)>& progressCallback) +bool Project::DeleteFolder(Ref<ProjectFolder> folder, const std::function<bool(size_t progress, size_t total)>& progressCallback) { ProgressContext cb; cb.callback = progressCallback; - BNProjectDeleteFolder(m_object, folder->m_object, &cb, ProgressCallback); + return BNProjectDeleteFolder(m_object, folder->m_object, &cb, ProgressCallback); } @@ -492,9 +492,9 @@ void Project::PushFile(Ref<ProjectFile> file) } -void Project::DeleteFile_(Ref<ProjectFile> file) +bool Project::DeleteFile_(Ref<ProjectFile> file) { - BNProjectDeleteFile(m_object, file->m_object); + return BNProjectDeleteFile(m_object, file->m_object); } diff --git a/python/project.py b/python/project.py index 02a4155c..d9b9880d 100644 --- a/python/project.py +++ b/python/project.py @@ -547,14 +547,15 @@ class Project: folder = ProjectFolder(handle) return folder - def delete_folder(self, folder: ProjectFolder, progress_func: ProgressFuncType = _nop): + def delete_folder(self, folder: ProjectFolder, progress_func: ProgressFuncType = _nop) -> bool: """ Recursively delete a folder from the project :param folder: Folder to delete recursively :param progress_func: Progress function that will be called as objects get deleted + :return: True if the folder was deleted, False otherwise """ - core.BNProjectDeleteFolder(self._handle, folder._handle, None, _wrap_progress(progress_func)) + return core.BNProjectDeleteFolder(self._handle, folder._handle, None, _wrap_progress(progress_func)) def create_file_from_path(self, path: AsPath, folder: Optional[ProjectFile], name: str, description: str = "", progress_func: ProgressFuncType = _nop) -> ProjectFile: """ @@ -646,13 +647,14 @@ class Project: file = ProjectFile(handle) return file - def delete_file(self, file: ProjectFile): + def delete_file(self, file: ProjectFile) -> bool: """ Delete a file from the project :param file: File to delete + :return: True if the file was deleted, False otherwise """ - core.BNProjectDeleteFile(self._handle, file._handle) + return core.BNProjectDeleteFile(self._handle, file._handle) @contextmanager def bulk_operation(self): |
