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)
95
95
}
96
96
97
97
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
+
98
109
string BinaryNinja::GetSettingsFileName ()
99
110
{
100
111
char * dir = BNGetSettingsFileName ();
Original file line number Diff line number Diff line change @@ -1241,6 +1241,12 @@ namespace BinaryNinja {
1241
1241
void SetBundledPluginDirectory(const std::string& path);
1242
1242
std::string GetUserDirectory();
1243
1243
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
+
1244
1250
std::string GetSettingsFileName();
1245
1251
std::string GetRepositoriesDirectory();
1246
1252
std::string GetInstallDirectory();
Original file line number Diff line number Diff line change @@ -7558,6 +7558,7 @@ extern "C"
7558
7558
BINARYNINJACOREAPI char ** BNGetFilePathsInDirectory (const char * path, size_t * count);
7559
7559
BINARYNINJACOREAPI char * BNAppendPath (const char * path, const char * part);
7560
7560
BINARYNINJACOREAPI void BNFreePath (char * path);
7561
+ BINARYNINJACOREAPI char * BNGetSystemCacheDirectory ();
7561
7562
7562
7563
// Settings APIs
7563
7564
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):
461
461
debugpy .wait_for_client ()
462
462
execute_on_main_thread (lambda : debugpy .debug_this_thread ())
463
463
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 ()
464
477
465
478
class UIPluginInHeadlessError (Exception ):
466
479
"""
You can’t perform that action at this time.
0 commit comments