forked from len0rd/rockbox
Fix Rockbox Utility update detection on Linux 64bit.
Remove the "64bit" part of the filename before comparing. We're checking for that in the filename explicitly but the version number doesn't contain it, so the comparison will otherwise misinterpret it as additional version information. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29617 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e937a78860
commit
fa565048f6
1 changed files with 23 additions and 17 deletions
|
|
@ -1280,44 +1280,49 @@ void RbUtilQt::downloadUpdateDone(bool error)
|
|||
}
|
||||
else {
|
||||
QString toParse(update->readAll());
|
||||
|
||||
|
||||
QRegExp searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>");
|
||||
QStringList rbutilList;
|
||||
int pos = 0;
|
||||
while ((pos = searchString.indexIn(toParse, pos)) != -1)
|
||||
while ((pos = searchString.indexIn(toParse, pos)) != -1)
|
||||
{
|
||||
rbutilList << searchString.cap(1);
|
||||
pos += searchString.matchedLength();
|
||||
}
|
||||
qDebug() << "[Checkupdate] " << rbutilList;
|
||||
|
||||
|
||||
QString newVersion = "";
|
||||
//check if there is a binary with higher version in this list
|
||||
QString foundVersion = "";
|
||||
// check if there is a binary with higher version in this list
|
||||
for(int i=0; i < rbutilList.size(); i++)
|
||||
{
|
||||
QString item = rbutilList.at(i);
|
||||
#if defined(Q_OS_LINUX)
|
||||
#if defined(__amd64__)
|
||||
//skip if it isnt a 64bit build
|
||||
if( !rbutilList.at(i).contains("64bit"))
|
||||
// skip if it isn't a 64 bit build
|
||||
if( !item.contains("64bit"))
|
||||
continue;
|
||||
// strip the "64bit" suffix for comparison
|
||||
item = item.remove("64bit");
|
||||
#else
|
||||
//skip if it is a 64bit build
|
||||
if(rbutilList.at(i).contains("64bit"))
|
||||
if(item.contains("64bit"))
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
//check if it is newer, and remember newest
|
||||
if(Utils::compareVersionStrings(VERSION, rbutilList.at(i)) == 1)
|
||||
#endif
|
||||
#endif
|
||||
// check if it is newer, and remember newest
|
||||
if(Utils::compareVersionStrings(VERSION, item) == 1)
|
||||
{
|
||||
if(Utils::compareVersionStrings(newVersion, rbutilList.at(i)) == 1)
|
||||
if(Utils::compareVersionStrings(newVersion, item) == 1)
|
||||
{
|
||||
newVersion = rbutilList.at(i);
|
||||
newVersion = item;
|
||||
foundVersion = rbutilList.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we found something newer, display info
|
||||
if(newVersion != "")
|
||||
if(foundVersion != "")
|
||||
{
|
||||
QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
|
||||
#if defined(Q_OS_WIN32)
|
||||
|
|
@ -1327,11 +1332,12 @@ void RbUtilQt::downloadUpdateDone(bool error)
|
|||
#elif defined(Q_OS_MACX)
|
||||
url += "macosx/";
|
||||
#endif
|
||||
url += newVersion;
|
||||
|
||||
url += foundVersion;
|
||||
|
||||
QMessageBox::information(this,tr("RockboxUtility Update available"),
|
||||
tr("<b>New RockboxUtility Version available.</b> <br><br>"
|
||||
"Download it from here: <a href='%1'>%2</a>").arg(url).arg(newVersion) );
|
||||
"Download it from here: <a href='%1'>%2</a>")
|
||||
.arg(url).arg(foundVersion));
|
||||
ui.statusbar->showMessage(tr("New version of Rockbox Utility available."));
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue