summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h26
-rw-r--r--binaryninjacore.h14
-rw-r--r--project.cpp52
-rw-r--r--python/project.py18
-rw-r--r--rust/src/project.rs10
5 files changed, 60 insertions, 60 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index a1429ec1..72e803b5 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -3640,10 +3640,10 @@ namespace BinaryNinja {
std::string GetId() const;
std::string GetName() const;
std::string GetDescription() const;
- void SetName(const std::string& name);
- void SetDescription(const std::string& description);
+ bool SetName(const std::string& name);
+ bool SetDescription(const std::string& description);
Ref<ProjectFolder> GetParent() const;
- void SetParent(Ref<ProjectFolder> parent);
+ bool SetParent(Ref<ProjectFolder> parent);
bool Export(const std::string& destination, const ProgressFunction& progressCallback = {}) const;
};
@@ -3662,11 +3662,11 @@ namespace BinaryNinja {
bool ExistsOnDisk() const;
std::string GetName() const;
std::string GetDescription() const;
- void SetName(const std::string& name);
- void SetDescription(const std::string& description);
+ bool SetName(const std::string& name);
+ bool SetDescription(const std::string& description);
std::string GetId() const;
Ref<ProjectFolder> GetFolder() const;
- void SetFolder(Ref<ProjectFolder> folder);
+ bool SetFolder(Ref<ProjectFolder> folder);
bool Export(const std::string& destination) const;
int64_t GetCreationTimestamp() const;
};
@@ -3696,13 +3696,13 @@ namespace BinaryNinja {
std::string GetPath() const;
std::string GetFilePathInProject(const Ref<ProjectFile>& file) const;
std::string GetName() const;
- void SetName(const std::string& name);
+ bool SetName(const std::string& name);
std::string GetDescription() const;
- void SetDescription(const std::string& description);
+ bool SetDescription(const std::string& description);
Ref<Metadata> QueryMetadata(const std::string& key);
bool StoreMetadata(const std::string& key, Ref<Metadata> value);
- void RemoveMetadata(const std::string& key);
+ bool RemoveMetadata(const std::string& key);
Ref<ProjectFolder> CreateFolderFromPath(const std::string& path, Ref<ProjectFolder> parent, const std::string& description,
const ProgressFunction& progressCallback = {});
@@ -3710,7 +3710,7 @@ namespace BinaryNinja {
Ref<ProjectFolder> CreateFolderUnsafe(Ref<ProjectFolder> parent, const std::string& name, const std::string& description, const std::string& id);
std::vector<Ref<ProjectFolder>> GetFolders() const;
Ref<ProjectFolder> GetFolderById(const std::string& id) const;
- void PushFolder(Ref<ProjectFolder> folder);
+ bool PushFolder(Ref<ProjectFolder> folder);
bool DeleteFolder(Ref<ProjectFolder> folder, const ProgressFunction& progressCallback = {});
Ref<ProjectFile> CreateFileFromPath(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const ProgressFunction& progressCallback = {});
@@ -3721,14 +3721,14 @@ namespace BinaryNinja {
Ref<ProjectFile> GetFileById(const std::string& id) const;
Ref<ProjectFile> GetFileByPathOnDisk(const std::string& path) const;
std::vector<Ref<ProjectFile>> GetFilesByPathInProject(const std::string& path) const;
- void PushFile(Ref<ProjectFile> file);
+ bool PushFile(Ref<ProjectFile> file);
bool DeleteFile_(Ref<ProjectFile> file);
void RegisterNotification(ProjectNotification* notify);
void UnregisterNotification(ProjectNotification* notify);
- void BeginBulkOperation();
- void EndBulkOperation();
+ bool BeginBulkOperation();
+ bool EndBulkOperation();
Ref<Collaboration::RemoteProject> GetRemoteProject();
};
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 619b1c98..146de0aa 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -4090,13 +4090,13 @@ extern "C"
BINARYNINJACOREAPI char* BNProjectGetPath(BNProject* project);
BINARYNINJACOREAPI char* BNProjectGetFilePathInProject(BNProject* project, BNProjectFile* file);
BINARYNINJACOREAPI char* BNProjectGetName(BNProject* project);
- BINARYNINJACOREAPI void BNProjectSetName(BNProject* project, const char* name);
+ BINARYNINJACOREAPI bool BNProjectSetName(BNProject* project, const char* name);
BINARYNINJACOREAPI char* BNProjectGetDescription(BNProject* project);
- BINARYNINJACOREAPI void BNProjectSetDescription(BNProject* project, const char* description);
+ BINARYNINJACOREAPI bool BNProjectSetDescription(BNProject* project, const char* description);
BINARYNINJACOREAPI BNMetadata* BNProjectQueryMetadata(BNProject* project, const char* key);
BINARYNINJACOREAPI bool BNProjectStoreMetadata(BNProject* project, const char* key, BNMetadata* value);
- BINARYNINJACOREAPI void BNProjectRemoveMetadata(BNProject* project, const char* key);
+ BINARYNINJACOREAPI bool BNProjectRemoveMetadata(BNProject* project, const char* key);
BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileFromPath(BNProject* project, const char* path, BNProjectFolder* folder, const char* name, const char* description, void* ctxt,
BNProgressFunction progress);
@@ -4111,7 +4111,7 @@ extern "C"
BINARYNINJACOREAPI BNProjectFile* BNProjectGetFileByPathOnDisk(BNProject* project, const char* path);
BINARYNINJACOREAPI BNProjectFile** BNProjectGetFilesByPathInProject(BNProject* project, const char* path, size_t* count);
- BINARYNINJACOREAPI void BNProjectPushFile(BNProject* project, BNProjectFile* file);
+ BINARYNINJACOREAPI bool BNProjectPushFile(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,
@@ -4120,12 +4120,12 @@ extern "C"
BINARYNINJACOREAPI BNProjectFolder* BNProjectCreateFolderUnsafe(BNProject* project, BNProjectFolder* parent, const char* name, const char* description, const char* id);
BINARYNINJACOREAPI BNProjectFolder** BNProjectGetFolders(BNProject* project, size_t* count);
BINARYNINJACOREAPI BNProjectFolder* BNProjectGetFolderById(BNProject* project, const char* id);
- BINARYNINJACOREAPI void BNProjectPushFolder(BNProject* project, BNProjectFolder* folder);
+ BINARYNINJACOREAPI bool BNProjectPushFolder(BNProject* project, BNProjectFolder* folder);
BINARYNINJACOREAPI bool BNProjectDeleteFolder(BNProject* project, BNProjectFolder* folder, void* ctxt,
BNProgressFunction progress);
- BINARYNINJACOREAPI void BNProjectBeginBulkOperation(BNProject* project);
- BINARYNINJACOREAPI void BNProjectEndBulkOperation(BNProject* project);
+ BINARYNINJACOREAPI bool BNProjectBeginBulkOperation(BNProject* project);
+ BINARYNINJACOREAPI bool BNProjectEndBulkOperation(BNProject* project);
BINARYNINJACOREAPI BNRemoteProject* BNProjectGetRemoteProject(BNProject* project);
diff --git a/project.cpp b/project.cpp
index e3e2b923..673927e5 100644
--- a/project.cpp
+++ b/project.cpp
@@ -304,9 +304,9 @@ std::string Project::GetName() const
}
-void Project::SetName(const std::string& name)
+bool Project::SetName(const std::string& name)
{
- BNProjectSetName(m_object, name.c_str());
+ return BNProjectSetName(m_object, name.c_str());
}
@@ -319,9 +319,9 @@ std::string Project::GetDescription() const
}
-void Project::SetDescription(const std::string& description)
+bool Project::SetDescription(const std::string& description)
{
- BNProjectSetDescription(m_object, description.c_str());
+ return BNProjectSetDescription(m_object, description.c_str());
}
@@ -340,9 +340,9 @@ bool Project::StoreMetadata(const std::string& key, Ref<Metadata> value)
}
-void Project::RemoveMetadata(const std::string& key)
+bool Project::RemoveMetadata(const std::string& key)
{
- BNProjectRemoveMetadata(m_object, key.c_str());
+ return BNProjectRemoveMetadata(m_object, key.c_str());
}
@@ -402,9 +402,9 @@ Ref<ProjectFolder> Project::GetFolderById(const std::string& id) const
}
-void Project::PushFolder(Ref<ProjectFolder> folder)
+bool Project::PushFolder(Ref<ProjectFolder> folder)
{
- BNProjectPushFolder(m_object, folder->m_object);
+ return BNProjectPushFolder(m_object, folder->m_object);
}
@@ -514,9 +514,9 @@ std::vector<Ref<ProjectFile>> Project::GetFilesByPathInProject(
}
-void Project::PushFile(Ref<ProjectFile> file)
+bool Project::PushFile(Ref<ProjectFile> file)
{
- BNProjectPushFile(m_object, file->m_object);
+ return BNProjectPushFile(m_object, file->m_object);
}
@@ -538,15 +538,15 @@ void Project::UnregisterNotification(ProjectNotification* notify)
}
-void Project::BeginBulkOperation()
+bool Project::BeginBulkOperation()
{
- BNProjectBeginBulkOperation(m_object);
+ return BNProjectBeginBulkOperation(m_object);
}
-void Project::EndBulkOperation()
+bool Project::EndBulkOperation()
{
- BNProjectEndBulkOperation(m_object);
+ return BNProjectEndBulkOperation(m_object);
}
@@ -613,15 +613,15 @@ std::string ProjectFile::GetDescription() const
}
-void ProjectFile::SetName(const std::string& name)
+bool ProjectFile::SetName(const std::string& name)
{
- BNProjectFileSetName(m_object, name.c_str());
+ return BNProjectFileSetName(m_object, name.c_str());
}
-void ProjectFile::SetDescription(const std::string& description)
+bool ProjectFile::SetDescription(const std::string& description)
{
- BNProjectFileSetDescription(m_object, description.c_str());
+ return BNProjectFileSetDescription(m_object, description.c_str());
}
@@ -643,9 +643,9 @@ Ref<ProjectFolder> ProjectFile::GetFolder() const
}
-void ProjectFile::SetFolder(Ref<ProjectFolder> folder)
+bool ProjectFile::SetFolder(Ref<ProjectFolder> folder)
{
- BNProjectFileSetFolder(m_object, folder ? folder->m_object : nullptr);
+ return BNProjectFileSetFolder(m_object, folder ? folder->m_object : nullptr);
}
@@ -700,15 +700,15 @@ std::string ProjectFolder::GetDescription() const
}
-void ProjectFolder::SetName(const std::string& name)
+bool ProjectFolder::SetName(const std::string& name)
{
- BNProjectFolderSetName(m_object, name.c_str());
+ return BNProjectFolderSetName(m_object, name.c_str());
}
-void ProjectFolder::SetDescription(const std::string& description)
+bool ProjectFolder::SetDescription(const std::string& description)
{
- BNProjectFolderSetDescription(m_object, description.c_str());
+ return BNProjectFolderSetDescription(m_object, description.c_str());
}
@@ -721,9 +721,9 @@ Ref<ProjectFolder> ProjectFolder::GetParent() const
}
-void ProjectFolder::SetParent(Ref<ProjectFolder> parent)
+bool ProjectFolder::SetParent(Ref<ProjectFolder> parent)
{
- BNProjectFolderSetParent(m_object, parent ? parent->m_object : nullptr);
+ return BNProjectFolderSetParent(m_object, parent ? parent->m_object : nullptr);
}
diff --git a/python/project.py b/python/project.py
index c8f87d2f..e8ab5198 100644
--- a/python/project.py
+++ b/python/project.py
@@ -193,7 +193,7 @@ class ProjectFile:
def get_path_on_disk(self) -> Optional[str]:
"""
Get this file's path on disk
-
+
:return: The path on disk of the file or None
"""
return core.BNProjectFileGetPathOnDisk(self._handle)
@@ -427,13 +427,13 @@ class Project:
return core.BNProjectGetName(self._handle) # type: ignore
@name.setter
- def name(self, new_name: str):
+ def name(self, new_name: str) -> bool:
"""
Set the name of the project
:param new_name: Desired name
"""
- core.BNProjectSetName(self._handle, new_name)
+ return core.BNProjectSetName(self._handle, new_name)
@property
def description(self) -> str:
@@ -445,13 +445,13 @@ class Project:
return core.BNProjectGetDescription(self._handle) # type: ignore
@description.setter
- def description(self, new_description: str):
+ def description(self, new_description: str) -> bool:
"""
Set the description of the project
:param new_description: Desired description
"""
- core.BNProjectSetDescription(self._handle, new_description)
+ return core.BNProjectSetDescription(self._handle, new_description)
def query_metadata(self, key: str) -> MetadataValueType:
"""
@@ -464,7 +464,7 @@ class Project:
raise KeyError(key)
return Metadata(handle=md_handle).value
- def store_metadata(self, key: str, value: MetadataValueType):
+ def store_metadata(self, key: str, value: MetadataValueType) -> bool:
"""
Stores metadata within the project
@@ -474,15 +474,15 @@ class Project:
_val = value
if not isinstance(_val, Metadata):
_val = Metadata(_val)
- core.BNProjectStoreMetadata(self._handle, key, _val.handle)
+ return core.BNProjectStoreMetadata(self._handle, key, _val.handle)
- def remove_metadata(self, key: str):
+ def remove_metadata(self, key: str) -> bool:
"""
Removes the metadata associated with this key from the project
:param str key: Key associated with the metadata object to remove
"""
- core.BNProjectRemoveMetadata(self._handle, key)
+ return core.BNProjectRemoveMetadata(self._handle, key)
def create_folder_from_path(self, path: Union[PathLike, str], parent: Optional[ProjectFolder] = None, description: str = "", progress_func: ProgressFuncType = _nop) -> ProjectFolder:
"""
diff --git a/rust/src/project.rs b/rust/src/project.rs
index f47c472a..6c0366c0 100644
--- a/rust/src/project.rs
+++ b/rust/src/project.rs
@@ -97,7 +97,7 @@ impl Project {
}
/// Set the name of the project
- pub fn set_name(&self, value: &str) {
+ pub fn set_name(&self, value: &str) -> bool {
let value = value.to_cstr();
unsafe { BNProjectSetName(self.handle.as_ptr(), value.as_ptr()) }
}
@@ -108,7 +108,7 @@ impl Project {
}
/// Set the description of the project
- pub fn set_description(&self, value: &str) {
+ pub fn set_description(&self, value: &str) -> bool {
let value = value.to_cstr();
unsafe { BNProjectSetDescription(self.handle.as_ptr(), value.as_ptr()) }
}
@@ -130,12 +130,12 @@ impl Project {
}
/// Removes the metadata associated with this `key` from the project
- pub fn remove_metadata(&self, key: &str) {
+ pub fn remove_metadata(&self, key: &str) -> bool {
let key_raw = key.to_cstr();
unsafe { BNProjectRemoveMetadata(self.handle.as_ptr(), key_raw.as_ptr()) }
}
- pub fn push_folder(&self, file: &ProjectFolder) {
+ pub fn push_folder(&self, file: &ProjectFolder) -> bool {
unsafe { BNProjectPushFolder(self.handle.as_ptr(), file.handle.as_ptr()) }
}
@@ -288,7 +288,7 @@ impl Project {
}
}
- pub fn push_file(&self, file: &ProjectFile) {
+ pub fn push_file(&self, file: &ProjectFile) -> bool {
unsafe { BNProjectPushFile(self.handle.as_ptr(), file.handle.as_ptr()) }
}