File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737// Current ABI version for linking to the core. This is incremented any time
3838// there are changes to the API that affect linking, including new functions,
3939// new types, or modifications to existing functions or types.
40- #define BN_CURRENT_CORE_ABI_VERSION 176
40+ #define BN_CURRENT_CORE_ABI_VERSION 177
4141
4242// Minimum ABI version that is supported for loading of plugins. Plugins that
4343// are linked to an ABI version less than this will not be able to load and
@@ -8295,6 +8295,7 @@ extern "C"
82958295 BINARYNINJACOREAPI BNPluginVersion* BNPluginGetVersions(BNPlugin* p, size_t* count);
82968296 BINARYNINJACOREAPI void BNFreePluginVersions(BNPluginVersion* r, size_t count);
82978297 BINARYNINJACOREAPI const char* BNPluginGetCurrentVersionID(BNPlugin* p);
8298+ BINARYNINJACOREAPI const char* BNPluginGetLatestVersionID(BNPlugin* p);
82988299 BINARYNINJACOREAPI BNPluginVersion BNPluginGetCurrentVersion(BNPlugin* p);
82998300 BINARYNINJACOREAPI void BNPluginFreeVersion(BNPluginVersion v);
83008301 BINARYNINJACOREAPI const char* BNPluginGetCommit(BNPlugin* p);
Original file line number Diff line number Diff line change @@ -199,10 +199,7 @@ std::string Extension::GetCurrentVersionID() const
199199
200200std::string Extension::GetLatestVersionID () const
201201{
202- auto versions = GetVersions ();
203- if (versions.empty ())
204- return " " ;
205- return versions.front ().id ;
202+ RETURN_STRING (BNPluginGetLatestVersionID (m_object));
206203}
207204
208205
Original file line number Diff line number Diff line change @@ -92,8 +92,6 @@ def installed(self) -> bool:
9292 def install (self , version_id = None ) -> bool :
9393 """Attempt to install the given plugin. Defaults to the latest available version."""
9494 self .install_dependencies ()
95- if version_id is None :
96- version_id = self .current_version .id
9795 return core .BNPluginInstall (self .handle , version_id )
9896
9997 def uninstall (self ) -> bool :
@@ -268,6 +266,13 @@ def current_version(self) -> ExtensionVersion:
268266 finally :
269267 core .BNPluginFreeVersion (version )
270268
269+ @property
270+ def latest_version_id (self ) -> str :
271+ """Latest version id available for this platform"""
272+ result = core .BNPluginGetLatestVersionID (self .handle )
273+ assert result is not None , "core.BNPluginGetLatestVersionID returned None"
274+ return result
275+
271276 @property
272277 def versions (self ) -> List [ExtensionVersion ]:
273278 """Version metadata for all available plugin versions"""
Original file line number Diff line number Diff line change @@ -136,6 +136,13 @@ impl Extension {
136136 ExtensionVersion :: from_owned_raw ( result)
137137 }
138138
139+ /// Latest version id available for this platform
140+ pub fn latest_version_id ( & self ) -> String {
141+ let result = unsafe { BNPluginGetLatestVersionID ( self . handle . as_ptr ( ) ) } ;
142+ assert ! ( !result. is_null( ) ) ;
143+ unsafe { BnString :: into_string ( result as * mut c_char ) }
144+ }
145+
139146 /// String plugin name
140147 pub fn name ( & self ) -> String {
141148 let result = unsafe { BNPluginGetName ( self . handle . as_ptr ( ) ) } ;
You can’t perform that action at this time.
0 commit comments