diff options
| -rw-r--r-- | binaryninjaapi.cpp | 11 | ||||
| -rw-r--r-- | binaryninjaapi.h | 1 | ||||
| -rw-r--r-- | binaryninjacore.h | 4 | ||||
| -rw-r--r-- | python/__init__.py | 9 |
4 files changed, 25 insertions, 0 deletions
diff --git a/binaryninjaapi.cpp b/binaryninjaapi.cpp index 6b303bcd..68cc2f43 100644 --- a/binaryninjaapi.cpp +++ b/binaryninjaapi.cpp @@ -59,6 +59,17 @@ void BinaryNinja::SetBundledPluginDirectory(const string& path) } +string BinaryNinja::GetInstallDirectory() +{ + char* path = BNGetInstallDirectory(); + if (!path) + return string(); + string result = path; + BNFreeString(path); + return result; +} + + string BinaryNinja::GetUserPluginDirectory() { char* path = BNGetUserPluginDirectory(); diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 6b69c95f..b8b684be 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -376,6 +376,7 @@ namespace BinaryNinja void InitUserPlugins(); std::string GetBundledPluginDirectory(); void SetBundledPluginDirectory(const std::string& path); + std::string GetInstallDirectory(); std::string GetUserPluginDirectory(); std::string GetPathRelativeToBundledPluginDirectory(const std::string& path); diff --git a/binaryninjacore.h b/binaryninjacore.h index d1c7f4d2..62889a4d 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -1247,10 +1247,14 @@ extern "C" // Plugin initialization BINARYNINJACOREAPI void BNInitCorePlugins(void); BINARYNINJACOREAPI void BNInitUserPlugins(void); + BINARYNINJACOREAPI char* BNGetInstallDirectory(void); BINARYNINJACOREAPI char* BNGetBundledPluginDirectory(void); BINARYNINJACOREAPI void BNSetBundledPluginDirectory(const char* path); + BINARYNINJACOREAPI char* BNGetUserDirectory(void); BINARYNINJACOREAPI char* BNGetUserPluginDirectory(void); + BINARYNINJACOREAPI void BNSaveLastRun(void); + BINARYNINJACOREAPI char* BNGetPathRelativeToBundledPluginDirectory(const char* path); BINARYNINJACOREAPI char* BNGetPathRelativeToUserPluginDirectory(const char* path); diff --git a/python/__init__.py b/python/__init__.py index b1f5cd08..dcbb8276 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -58,6 +58,15 @@ def get_unique_identifier(): return core.BNGetUniqueIdentifierString() +def get_install_directory(): + """ + ``get_install_directory`` returns a string pointing to the installed binary currently running + + .warning:: ONLY for use within the Binary Ninja UI, behavior is undefined and unreliable if run headlessly + """ + return core.BNGetInstallDirectory() + + class _DestructionCallbackHandler(object): def __init__(self): self._cb = core.BNObjectDestructionCallbacks() |
