diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-10 14:34:55 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-11-10 14:34:55 +0000 |
commit | 9144326f77433c88f15e6a361fe89ac7e768f2e9 (patch) | |
tree | b9a76efd6267cca2536e0f128397bd52c4d8fa3a | |
parent | 2886b7401df329c54ab9124ad19b31b8ccc86c10 (diff) |
If more then file with the same name exist on addons, file with largest version number will be used
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@556 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | updater/xmldata.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/updater/xmldata.cpp b/updater/xmldata.cpp index d8017a5..e8b1f3a 100644 --- a/updater/xmldata.cpp +++ b/updater/xmldata.cpp @@ -427,6 +427,7 @@ int FindFileID(const char *name, const Category cat, UpdateList *update_list) { // ignore case in name
int id = -1;
+ char *version = NULL;
ezxml_t root = ezxml_get(doc[cat], "channel", 0, "item", -1);
while (root) {
@@ -434,8 +435,16 @@ int FindFileID(const char *name, const Category cat, UpdateList *update_list) { if (_stricmp(title, name) == 0) {
const char* subcategory = ezxml_txt(ezxml_child(root, "subcategory"));
if (strcmp(subcategory, "Archived")) {
- id = atoi(ezxml_txt(ezxml_child(root, "id")));
- if (id) break; else id = -1;
+ int id1 = atoi(ezxml_txt(ezxml_child(root, "id")));
+ if (id1)
+ {
+ char *version1 = ezxml_txt(ezxml_child(root, "version"));
+ if (!version || (version1 && VersionLess(version, version1)))
+ {
+ version = version1;
+ id = id1;
+ }
+ }
}
}
root = ezxml_next(root);
|