mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Changed: List all required files and copy them, see #279
This commit is contained in:
parent
e67057a814
commit
0fc9667cb2
8 changed files with 86 additions and 58 deletions
|
@ -51,3 +51,7 @@ IF(WITH_PCH)
|
|||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS ryzom_installer_qt RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client)
|
||||
|
||||
IF(UNIX AND NOT APPLE)
|
||||
INSTALL(FILES res/ryzom_installer.png DESTINATION ${RYZOM_SHARE_PREFIX} COMPONENT client)
|
||||
ENDIF()
|
||||
|
|
BIN
code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.png
Normal file
BIN
code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
|
@ -831,6 +831,51 @@ QString CConfigFile::getInstallerMenuLinkFullPath() const
|
|||
#endif
|
||||
}
|
||||
|
||||
QStringList CConfigFile::getInstallerRequiredFiles() const
|
||||
{
|
||||
// list of all files required by installer (and its executable too)
|
||||
QStringList files;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
// VC++ runtimes
|
||||
#if _MSC_VER == 1900
|
||||
// VC++ 2015
|
||||
files << "msvcp140.dll";
|
||||
files << "msvcr140.dll";
|
||||
#elif _MSC_VER == 1800
|
||||
// VC++ 2013
|
||||
files << "msvcp120.dll";
|
||||
files << "msvcr120.dll";
|
||||
#elif _MSC_VER == 1700
|
||||
// VC++ 2012
|
||||
files << "msvcp110.dll";
|
||||
files << "msvcr110.dll";
|
||||
#elif _MSC_VER == 1600
|
||||
// VC++ 2010
|
||||
files << "msvcp100.dll";
|
||||
files << "msvcr100.dll";
|
||||
#elif _MSC_VER == 1500
|
||||
// VC++ 2008
|
||||
files << "msvcp90.dll";
|
||||
files << "msvcr90.dll";
|
||||
#else
|
||||
// unsupported compiler
|
||||
#endif
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
// TODO: for OS X
|
||||
#else
|
||||
// icon under Linux
|
||||
files << "ryzom_installer.png";
|
||||
#endif
|
||||
|
||||
// include current executable
|
||||
files << QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
QString CConfigFile::getSrcServerClientBNPFullPath() const
|
||||
{
|
||||
return QString("%1/unpack/exedll_%2.bnp").arg(getSrcServerDirectory()).arg(getClientArch());
|
||||
|
|
|
@ -181,6 +181,8 @@ public:
|
|||
QString getInstallerFullPath() const;
|
||||
QString getInstallerMenuLinkFullPath() const;
|
||||
|
||||
QStringList getInstallerRequiredFiles() const;
|
||||
|
||||
QString getSrcServerClientBNPFullPath() const;
|
||||
|
||||
OperationStep getInstallNextStep() const;
|
||||
|
|
|
@ -47,6 +47,39 @@
|
|||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
// copy all specified files from current directory to destination directory
|
||||
bool copyInstallerFiles(const QStringList &files, const QString &destination)
|
||||
{
|
||||
QString path = QApplication::applicationDirPath();
|
||||
|
||||
foreach(const QString &file, files)
|
||||
{
|
||||
// convert to absolute path
|
||||
QString srcPath = path + "/" + file;
|
||||
QString dstPath = destination + "/" + file;
|
||||
|
||||
if (QFile::exists(srcPath))
|
||||
{
|
||||
if (QFile::exists(dstPath))
|
||||
{
|
||||
if (!QFile::remove(dstPath))
|
||||
{
|
||||
qDebug() << "Unable to delete" << dstPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!QFile::copy(srcPath, dstPath))
|
||||
{
|
||||
qDebug() << "Unable to copy" << srcPath << "to" << dstPath;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
|
@ -115,7 +148,7 @@ int main(int argc, char *argv[])
|
|||
if (QApplication::applicationDirPath() != tempPath)
|
||||
{
|
||||
// copy installer and required files to TEMP directory
|
||||
if (copyInstallerExecutable(tempPath))
|
||||
if (copyInstallerFiles(config.getInstallerRequiredFiles(), tempPath))
|
||||
{
|
||||
QString tempFile = tempPath + "/" + QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
|
||||
|
|
|
@ -715,13 +715,8 @@ void COperationDialog::copyInstaller()
|
|||
|
||||
if (!QFile::exists(newInstallerFullPath))
|
||||
{
|
||||
QStringList filter;
|
||||
filter << "msvcp100.dll";
|
||||
filter << "msvcr100.dll";
|
||||
filter << "ryzom_installer.png";
|
||||
|
||||
CFilesCopier copier(this);
|
||||
copier.setIncludeFilter(filter);
|
||||
copier.setIncludeFilter(config->getInstallerRequiredFiles());
|
||||
copier.addFile(oldInstallerFullPath);
|
||||
copier.setSourceDirectory(config->getSrcServerDirectory().isEmpty() ? QApplication::applicationDirPath():config->getSrcServerDirectory());
|
||||
copier.setDestinationDirectory(config->getInstallationDirectory());
|
||||
|
|
|
@ -239,52 +239,3 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool copyInstallerExecutable(const QString &destination)
|
||||
{
|
||||
QString path = QApplication::applicationDirPath();
|
||||
|
||||
QStringList files;
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
// VC++ runtimes
|
||||
#if _MSC_VER == 1900
|
||||
files << "msvcp140.dll";
|
||||
files << "msvcr140.dll";
|
||||
#else _MSC_VER == 1600
|
||||
files << "msvcp100.dll";
|
||||
files << "msvcr100.dll";
|
||||
#endif
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
files << QFileInfo(QApplication::applicationFilePath()).fileName();
|
||||
|
||||
foreach(const QString &file, files)
|
||||
{
|
||||
// convert to absolute path
|
||||
QString srcPath = path + "/" + file;
|
||||
QString dstPath = destination + "/" + file;
|
||||
|
||||
if (QFile::exists(srcPath))
|
||||
{
|
||||
if (QFile::exists(dstPath))
|
||||
{
|
||||
if (!QFile::remove(dstPath))
|
||||
{
|
||||
qDebug() << "Unable to delete" << dstPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!QFile::copy(srcPath, dstPath))
|
||||
{
|
||||
qDebug() << "Unable to copy" << srcPath << "to" << dstPath;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,4 @@ wchar_t* qToWide(const QString &str);
|
|||
bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir);
|
||||
bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj);
|
||||
|
||||
bool copyInstallerExecutable(const QString &destination);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue