addon/state: Use .pbl files first to get local add-on versions...

...when applicable

This is used when an add-on has a .pbl file. This way it's possible to
highlight an add-on as 'outdated on the server' when a new version is
ready for uploading. Add-ons without a .pbl file should still use the
_info.cfg file.
This commit is contained in:
Ignacio R. Morelle 2012-05-30 21:54:17 +00:00
parent 26257fbcea
commit 49b36663bc

View File

@ -30,11 +30,23 @@ addon_tracking_info get_addon_tracking_info(const addon_info& addon)
t.can_publish = have_addon_pbl_info(id);
t.in_version_control = have_addon_in_vcs_tree(id);
t.installed_version = version_info();
t.installed_version = version_info(0, 0, 0, false);
if(is_addon_installed(id)) {
try {
t.installed_version = get_addon_version_info(id);
if(t.can_publish) {
// Try to obtain the version number from the .pbl first.
config pbl;
get_addon_pbl_info(id, pbl);
if(pbl.has_attribute("version")) {
t.installed_version = pbl["version"].str();
}
} else {
// We normally use the _info.cfg version instead.
t.installed_version = get_addon_version_info(id);
}
const version_info& remote_version = addon.version;
if(remote_version == t.installed_version) {