Changed: Rerun installer from TEMP under Windows, see #279
--HG-- branch : develop
This commit is contained in:
parent
2bc1e26868
commit
373654ea46
4 changed files with 43 additions and 21 deletions
|
@ -722,11 +722,28 @@ bool CConfigFile::shouldCreateMenuShortcut() const
|
|||
return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(shortcut));
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerFullPath() const
|
||||
QString CConfigFile::getInstallerCurrentFilePath() const
|
||||
{
|
||||
// installer is always run from TEMP under Windows
|
||||
return QApplication::applicationFilePath();
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerCurrentDirPath() const
|
||||
{
|
||||
// installer is always run from TEMP under Windows
|
||||
return QApplication::applicationDirPath();
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerOriginalFilePath() const
|
||||
{
|
||||
return getInstallerOriginalDirPath() + "/" + QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerOriginalDirPath() const
|
||||
{
|
||||
return m_installationDirectory;
|
||||
}
|
||||
|
||||
QString CConfigFile::getInstallerMenuLinkFullPath() const
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
|
|
|
@ -113,7 +113,11 @@ public:
|
|||
|
||||
QString getClientArch() const;
|
||||
|
||||
QString getInstallerFullPath() const;
|
||||
QString getInstallerCurrentFilePath() const;
|
||||
QString getInstallerCurrentDirPath() const;
|
||||
QString getInstallerOriginalFilePath() const;
|
||||
QString getInstallerOriginalDirPath() const;
|
||||
|
||||
QString getInstallerMenuLinkFullPath() const;
|
||||
|
||||
QStringList getInstallerRequiredFiles() const;
|
||||
|
|
|
@ -120,6 +120,24 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(_DEBUG)
|
||||
// under Windows, Ryzom Installer should always be copied in TEMP directory
|
||||
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||
|
||||
// check if launched from TEMP directory
|
||||
if (step == Done && QApplication::applicationDirPath() != tempPath)
|
||||
{
|
||||
// copy installer and required files to TEMP directory
|
||||
if (copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
|
||||
{
|
||||
QString tempFile = tempPath + "/" + QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
|
||||
// launch copy in TEMP directory with same arguments
|
||||
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// use product name from ryzom_installer.ini
|
||||
if (!config.getProductName().isEmpty()) QApplication::setApplicationName(config.getProductName());
|
||||
|
||||
|
@ -141,23 +159,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (parser.isSet(uninstallOption))
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(_DEBUG)
|
||||
QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||
|
||||
// check if launched from TEMP directory
|
||||
if (QApplication::applicationDirPath() != tempPath)
|
||||
{
|
||||
// copy installer and required files to TEMP directory
|
||||
if (copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
|
||||
{
|
||||
QString tempFile = tempPath + "/" + QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
|
||||
// launch copy in TEMP directory with same arguments
|
||||
if (QProcess::startDetached(tempFile, QApplication::arguments())) return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SComponents components;
|
||||
|
||||
// add all servers by default
|
||||
|
|
|
@ -1135,7 +1135,7 @@ void COperationDialog::deleteComponentsInstaller()
|
|||
dir.removeRecursively();
|
||||
}
|
||||
|
||||
path = config->getInstallerFullPath();
|
||||
path = config->getInstallerOriginalDirPath();
|
||||
QStringList files = config->getInstallerRequiredFiles();
|
||||
|
||||
foreach(const QString &file, files)
|
||||
|
@ -1143,7 +1143,7 @@ void COperationDialog::deleteComponentsInstaller()
|
|||
QString fullPath = path + "/" + file;
|
||||
|
||||
// delete file
|
||||
if (!QFile::remove(fullPath))
|
||||
if (QFile::exists(fullPath) && !QFile::remove(fullPath))
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// under Windows, a running executable is locked, so we need to delete it later
|
||||
|
|
Loading…
Reference in a new issue