mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Changed: Implements shouldCopyInstaller() based on version from executable, see #279
--HG-- branch : develop
This commit is contained in:
parent
ba8673432b
commit
f5ba2e2ff5
2 changed files with 22 additions and 17 deletions
|
@ -749,6 +749,26 @@ bool CConfigFile::shouldCreateMenuShortcut() const
|
|||
return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(shortcut));
|
||||
}
|
||||
|
||||
bool CConfigFile::shouldCopyInstaller() const
|
||||
{
|
||||
const CProfile &p = getProfile();
|
||||
const CServer &s = getServer(p.server);
|
||||
|
||||
QString installerDst = getInstallationDirectory() + "/" + s.installerFilename;
|
||||
|
||||
// if installer not found in installation directory, extract it from BNP
|
||||
if (!QFile::exists(installerDst)) return true;
|
||||
|
||||
QString installedVersion = getVersionFromExecutable(installerDst);
|
||||
QString newVersion = QApplication::applicationVersion();
|
||||
|
||||
QVersionNumber installedVer = QVersionNumber::fromString(installedVersion);
|
||||
QVersionNumber newVer = QVersionNumber::fromString(newVersion);
|
||||
|
||||
// if version is greater, copy it
|
||||
return newVer > installedVer;
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerCurrentFilePath() const
|
||||
{
|
||||
// installer is always run from TEMP under Windows
|
||||
|
@ -955,23 +975,7 @@ OperationStep CConfigFile::getInstallNextStep() const
|
|||
}
|
||||
}
|
||||
|
||||
QString installerDst = getInstallationDirectory() + "/" + server.installerFilename;
|
||||
|
||||
// if installer not found in installation directory, extract it from BNP
|
||||
if (QFile::exists(installerDst))
|
||||
{
|
||||
QString installerSrc = getInstallerCurrentFilePath();
|
||||
|
||||
// copy it too if destination one if older than new one
|
||||
uint64 srcDate = QFileInfo(installerSrc).lastModified().toTime_t();
|
||||
uint64 dstDate = QFileInfo(installerDst).lastModified().toTime_t();
|
||||
|
||||
if (srcDate > dstDate) return CopyInstaller;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CopyInstaller;
|
||||
}
|
||||
if (shouldCopyInstaller()) return CopyInstaller;
|
||||
|
||||
// no default profile
|
||||
if (profile.id.isEmpty())
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
bool foundTemporaryFiles(const QString &directory) const;
|
||||
bool shouldCreateDesktopShortcut() const;
|
||||
bool shouldCreateMenuShortcut() const;
|
||||
bool shouldCopyInstaller() const;
|
||||
|
||||
// installation choices
|
||||
bool use64BitsClient() const;
|
||||
|
|
Loading…
Reference in a new issue