From 9144326f77433c88f15e6a361fe89ac7e768f2e9 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Wed, 10 Nov 2010 14:34:55 +0000 Subject: 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 --- updater/xmldata.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'updater/xmldata.cpp') 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); -- cgit v1.2.3