mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 18:40:54 +00:00
Merge with develop
This commit is contained in:
parent
ff2bb04474
commit
0c63da38f1
3 changed files with 48 additions and 28 deletions
|
@ -974,29 +974,7 @@ OperationStep CConfigFile::getInstallNextStep() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// current installer more recent than installed one
|
// current installer more recent than installed one
|
||||||
switch (compareInstallersVersion())
|
if (compareInstallersVersion() == 1) return CopyInstaller;
|
||||||
{
|
|
||||||
// current installer more recent, copy it
|
|
||||||
case 1: return CopyInstaller;
|
|
||||||
|
|
||||||
// current installer older, launch the more recent installer
|
|
||||||
case -1: return LaunchInstalledInstaller;
|
|
||||||
|
|
||||||
// continue only if 0 and launched Installer is the installed one
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
|
||||||
|
|
||||||
// check if launched from TEMP directory
|
|
||||||
bool rightPath = getInstallerCurrentDirPath().startsWith(tempPath);
|
|
||||||
#else
|
|
||||||
bool rightPath = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!rightPath && getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no default profile
|
// no default profile
|
||||||
if (profile.id.isEmpty())
|
if (profile.id.isEmpty())
|
||||||
|
@ -1039,6 +1017,31 @@ OperationStep CConfigFile::getInstallNextStep() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// current installer more recent than installed one
|
||||||
|
switch (compareInstallersVersion())
|
||||||
|
{
|
||||||
|
// current installer more recent, copy it
|
||||||
|
case 1: break;
|
||||||
|
|
||||||
|
// current installer older, launch the more recent installer
|
||||||
|
case -1: return LaunchInstalledInstaller;
|
||||||
|
|
||||||
|
// continue only if 0 and launched Installer is the installed one
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||||
|
|
||||||
|
// check if launched from TEMP directory
|
||||||
|
bool rightPath = getInstallerCurrentDirPath().startsWith(tempPath);
|
||||||
|
#else
|
||||||
|
bool rightPath = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!rightPath && getInstallerCurrentFilePath() != getInstallerInstalledFilePath() && QFile::exists(getInstallerInstalledFilePath())) return LaunchInstalledInstaller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Done;
|
return Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,18 @@ void CFilesCopier::getFile(const QFileInfo &fileInfo, const QDir &srcDir, FilesT
|
||||||
// full path to file
|
// full path to file
|
||||||
QString fullPath = fileInfo.absoluteFilePath();
|
QString fullPath = fileInfo.absoluteFilePath();
|
||||||
|
|
||||||
|
QString relativePath = srcDir.relativeFilePath(fullPath);
|
||||||
|
|
||||||
|
QFileInfo relativeFileInfo(relativePath);
|
||||||
|
|
||||||
|
// correct absolute path
|
||||||
|
if (relativeFileInfo.isAbsolute())
|
||||||
|
{
|
||||||
|
relativePath = relativeFileInfo.fileName();
|
||||||
|
}
|
||||||
|
|
||||||
// full path where to copy file
|
// full path where to copy file
|
||||||
QString dstPath = m_destinationDirectory + "/" + srcDir.relativeFilePath(fullPath);
|
QString dstPath = m_destinationDirectory + "/" + relativePath;
|
||||||
|
|
||||||
if (fileInfo.isDir())
|
if (fileInfo.isDir())
|
||||||
{
|
{
|
||||||
|
|
|
@ -242,6 +242,8 @@ int main(int argc, char *argv[])
|
||||||
step = config.getInstallNextStep();
|
step = config.getInstallNextStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool restartInstaller = false;
|
||||||
|
|
||||||
if (step != Done)
|
if (step != Done)
|
||||||
{
|
{
|
||||||
COperationDialog dialog;
|
COperationDialog dialog;
|
||||||
|
@ -254,20 +256,25 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (step == LaunchInstalledInstaller)
|
if (step == LaunchInstalledInstaller)
|
||||||
{
|
{
|
||||||
#ifndef _DEBUG
|
|
||||||
// restart more recent installed Installer version
|
// restart more recent installed Installer version
|
||||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
restartInstaller = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (step == Done)
|
else if (step == Done)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) && !defined(_DEBUG)
|
#if defined(Q_OS_WIN) && !defined(_DEBUG)
|
||||||
// restart Installer, so it could be copied in TEMP and allowed to update itself
|
// restart Installer, so it could be copied in TEMP and allowed to update itself
|
||||||
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
restartInstaller = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restartInstaller)
|
||||||
|
{
|
||||||
|
#ifndef _DEBUG
|
||||||
|
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
CMainWindow mainWindow;
|
CMainWindow mainWindow;
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue