diff options
Diffstat (limited to 'view/sharedcache/api/python')
| -rw-r--r-- | view/sharedcache/api/python/_sharedcachecore_template.py | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/view/sharedcache/api/python/_sharedcachecore_template.py b/view/sharedcache/api/python/_sharedcachecore_template.py index 6b5b174f..01cf4b02 100644 --- a/view/sharedcache/api/python/_sharedcachecore_template.py +++ b/view/sharedcache/api/python/_sharedcachecore_template.py @@ -8,22 +8,37 @@ import platform core = None core_platform = platform.system() -# By the time the debugger is loaded, binaryninja has not fully initialized. -# So we cannot call binaryninja.bundled_plugin_path() -from binaryninja._binaryninjacore import BNGetBundledPluginDirectory, BNFreeString -if core_platform == "Darwin": - _base_path = BNGetBundledPluginDirectory() - core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.dylib")) +from binaryninja import Settings +if Settings().get_bool("corePlugins.view.sharedCache"): + from binaryninja._binaryninjacore import BNGetBundledPluginDirectory + if core_platform == "Darwin": + _base_path = BNGetBundledPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.dylib")) -elif core_platform == "Linux": - _base_path = BNGetBundledPluginDirectory() - core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.so")) + elif core_platform == "Linux": + _base_path = BNGetBundledPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.so")) -elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): - _base_path = BNGetBundledPluginDirectory() - core = ctypes.CDLL(os.path.join(_base_path, "sharedcache.dll")) + elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): + _base_path = BNGetBundledPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "sharedcache.dll")) + else: + raise Exception("OS not supported") else: - raise Exception("OS not supported") + from binaryninja._binaryninjacore import BNGetUserPluginDirectory + if core_platform == "Darwin": + _base_path = BNGetUserPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.dylib")) + + elif core_platform == "Linux": + _base_path = BNGetUserPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "libsharedcache.so")) + + elif (core_platform == "Windows") or (core_platform.find("CYGWIN_NT") == 0): + _base_path = BNGetUserPluginDirectory() + core = ctypes.CDLL(os.path.join(_base_path, "sharedcache.dll")) + else: + raise Exception("OS not supported") def cstr(var) -> Optional[ctypes.c_char_p]: if var is None: |
