File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,17 @@ string BinaryNinja::GetUserDirectory(void)
9595}
9696
9797
98+ string BinaryNinja::GetSystemCacheDirectory ()
99+ {
100+ char * dir = BNGetSystemCacheDirectory ();
101+ if (!dir)
102+ return string ();
103+ std::string result (dir);
104+ BNFreeString (dir);
105+ return result;
106+ }
107+
108+
98109string BinaryNinja::GetSettingsFileName ()
99110{
100111 char * dir = BNGetSettingsFileName ();
Original file line number Diff line number Diff line change @@ -1241,6 +1241,12 @@ namespace BinaryNinja {
12411241 void SetBundledPluginDirectory(const std::string& path);
12421242 std::string GetUserDirectory();
12431243
1244+ /*! Get the Binary Ninja system cache directory
1245+ *
1246+ * @return std::string - Binary Ninja's cache directory on a given system
1247+ */
1248+ std::string GetSystemCacheDirectory();
1249+
12441250 std::string GetSettingsFileName();
12451251 std::string GetRepositoriesDirectory();
12461252 std::string GetInstallDirectory();
Original file line number Diff line number Diff line change @@ -7558,6 +7558,7 @@ extern "C"
75587558 BINARYNINJACOREAPI char ** BNGetFilePathsInDirectory (const char * path, size_t * count);
75597559 BINARYNINJACOREAPI char * BNAppendPath (const char * path, const char * part);
75607560 BINARYNINJACOREAPI void BNFreePath (char * path);
7561+ BINARYNINJACOREAPI char * BNGetSystemCacheDirectory ();
75617562
75627563 // Settings APIs
75637564 BINARYNINJACOREAPI BNSettings* BNCreateSettings (const char * schemaId);
Original file line number Diff line number Diff line change @@ -461,6 +461,19 @@ def connect_vscode_debugger(port=5678):
461461 debugpy .wait_for_client ()
462462 execute_on_main_thread (lambda : debugpy .debug_this_thread ())
463463
464+ def get_system_cache_directory () -> Optional [str ]:
465+ """
466+ Returns Binary Ninja's system cache directory on the system.
467+
468+ Supported default locations:
469+
470+ - macOS: ~/Library/Caches/Binary Ninja
471+ - Linux: $XDG_CACHE_HOME/Binary Ninja or ~/.cache/Binary Ninja
472+ - Windows: %LOCALAPPDATA%/Binary Ninja/cache
473+
474+ :return: Returns a string containing the system cache directory, or None on failure.
475+ """
476+ return core .BNGetSystemCacheDirectory ()
464477
465478class UIPluginInHeadlessError (Exception ):
466479 """
You can’t perform that action at this time.
0 commit comments