diff --git a/code/ryzom/tools/client/ryzom_installer/CMakeLists.txt b/code/ryzom/tools/client/ryzom_installer/CMakeLists.txt index b096af884..2726ea489 100644 --- a/code/ryzom/tools/client/ryzom_installer/CMakeLists.txt +++ b/code/ryzom/tools/client/ryzom_installer/CMakeLists.txt @@ -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() diff --git a/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.png b/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.png new file mode 100644 index 000000000..67e3034ef Binary files /dev/null and b/code/ryzom/tools/client/ryzom_installer/res/ryzom_installer.png differ diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 71dc77ca8..cb0ceed99 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -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()); diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 2ac3070f2..de3440086 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -181,6 +181,8 @@ public: QString getInstallerFullPath() const; QString getInstallerMenuLinkFullPath() const; + QStringList getInstallerRequiredFiles() const; + QString getSrcServerClientBNPFullPath() const; OperationStep getInstallNextStep() const; diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index f46790110..82ab9939c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -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(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index c24943f7d..eec9d231e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -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()); diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 1e3c324a7..cdbadc246 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -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; -} diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.h b/code/ryzom/tools/client/ryzom_installer/src/utils.h index 8072f69d6..363c30b9e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.h +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.h @@ -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