From b193faa4263a30b919f234076a501c68f924dee7 Mon Sep 17 00:00:00 2001 From: Gary Preston Date: Thu, 18 Feb 2016 13:53:14 +0000 Subject: [PATCH 1/8] Ensure definitions from cmake files that make use of generator expressions (such as UseQt4.cmake) are retained but do not cause a empty "-D" to be output when the generator evaluates to the empty string. Fixes debug build failure on Linux using Qt4/tools/WITH_PCH. --HG-- branch : develop --- code/CMakeModules/PCHSupport.cmake | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 20539e87f..92b76513b 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -56,33 +56,37 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND _FLAGS " -I\"${item}\"") ENDFOREACH() + # NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate + # to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated + # expression is not empty. + # Required for CMake 2.6 SET(GLOBAL_DEFINITIONS) GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() @@ -106,14 +110,14 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() @@ -135,10 +139,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(_DEFINITIONS) FOREACH(item ${_DEFINITIONS}) - # don't use dynamic expressions - IF(NOT item MATCHES "\\$<") - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDIF() + LIST(APPEND GLOBAL_DEFINITIONS "$<$:-D$>") ENDFOREACH() ENDIF() ENDIF() @@ -149,7 +150,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB") # Hack to define missing QT_NO_DEBUG with Qt 5.2 IF(_UPPER_BUILD STREQUAL "RELEASE") - LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG") + LIST(APPEND GLOBAL_DEFINITIONS "-DQT_NO_DEBUG") ENDIF() # Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIC @@ -162,8 +163,6 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDIF() ENDIF() - LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") - IF(CMAKE_VERSION VERSION_LESS "3.3.0") GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) @@ -180,6 +179,9 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) SEPARATE_ARGUMENTS(_FLAGS) ENDIF() + # Already in list form and items may contain non-leading spaces that should not be split on + LIST(INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}") + IF(CLANG) # Determining all architectures and get common flags SET(_ARCH_NEXT) From 6b9a267abc1f5fdd42a1b81f07c971747689d492 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 12:53:10 +0200 Subject: [PATCH 2/8] Changed: Only enable migration under Windows when launched from 2.1 client directory --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 53 ------------------- .../client/ryzom_installer/src/configfile.h | 2 - .../ryzom_installer/src/migratedialog.cpp | 27 ++-------- .../ryzom_installer/src/migratedialog.h | 4 ++ 4 files changed, 9 insertions(+), 77 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index bf3c64cb2..c6b7a577d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -505,59 +505,6 @@ QString CConfigFile::getParentDirectory() return current.absolutePath(); } -QString CConfigFile::getOldInstallationDirectory() -{ - // HKEY_CURRENT_USER/SOFTWARE/Nevrax/RyzomInstall/InstallId=1917716796 (string) -#if defined(Q_OS_WIN) - // NSIS previous official installer -#ifdef Q_OS_WIN64 - // use WOW6432Node in 64 bits (64 bits OS and 64 bits Installer) because Ryzom old installer was in 32 bits - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Nevrax\\Ryzom", QSettings::NativeFormat); -#else - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat); -#endif - - if (settings.contains("Ryzom Install Path")) - { - return QDir::fromNativeSeparators(settings.value("Ryzom Install Path").toString()); - } - - // check default directory if registry key not found - return CConfigFile::has64bitsOS() ? "C:/Program Files (x86)/Ryzom":"C:/Program Files/Ryzom"; -#elif defined(Q_OS_MAC) - return "/Applications/Ryzom.app"; -#else - return QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.ryzom"; -#endif -} - -QString CConfigFile::getOldInstallationLanguage() -{ -#if defined(Q_OS_WIN) - // NSIS previous official installer -#ifdef Q_OS_WIN64 - // use WOW6432Node in 64 bits (64 bits OS and 64 bits Installer) because Ryzom old installer was in 32 bits - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Nevrax\\Ryzom", QSettings::NativeFormat); -#else - QSettings settings("HKEY_LOCAL_MACHINE\\Software\\Nevrax\\Ryzom", QSettings::NativeFormat); -#endif - - QString key = "Language"; - - if (settings.contains(key)) - { - QString languageCode = settings.value(key).toString(); - - // 1036 = French (France), 1033 = English (USA), 1031 = German - if (languageCode == "1036") return "fr"; - if (languageCode == "1031") return "de"; - if (languageCode == "1033") return "en"; - } -#endif - - return ""; -} - QString CConfigFile::getNewInstallationLanguage() { #if defined(Q_OS_WIN) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index 1f71ad56b..d1560c40e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -90,9 +90,7 @@ public: // default directories static QString getCurrentDirectory(); static QString getParentDirectory(); - static QString getOldInstallationDirectory(); static QString getNewInstallationDirectory(); - static QString getOldInstallationLanguage(); static QString getNewInstallationLanguage(); // status of installation diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index 0aec91d09..6c9f6f1e5 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -16,6 +16,9 @@ #include "stdpch.h" #include "migratedialog.h" + +#ifdef Q_OS_WIN32 + #include "configfile.h" #include "utils.h" @@ -49,12 +52,6 @@ CMigrateDialog::CMigrateDialog():QDialog() // update default destination onDestinationDefaultButtonClicked(); -#ifdef Q_OS_MAC - // only 64 bits for OS X - clientArchGroupBox->setVisible(false); - clientArch64RadioButton->setChecked(true); - clientArch32RadioButton->setChecked(false); -#elif defined(Q_OS_WIN32) // both 32 and 64 bits are working under Windows 64 bits // check whether OS architecture is 32 or 64 bits @@ -72,22 +69,6 @@ CMigrateDialog::CMigrateDialog():QDialog() clientArch64RadioButton->setChecked(false); clientArch32RadioButton->setChecked(true); } -#else - // only use the current architecture for Linux - - clientArchGroupBox->setVisible(false); - -#ifdef _LP64 - // only 64 bits is available - clientArch64RadioButton->setChecked(true); - clientArch32RadioButton->setChecked(false); -#else - // only 32 bits is available - clientArch64RadioButton->setChecked(false); - clientArch32RadioButton->setChecked(true); -#endif - -#endif const CServer &server = CConfigFile::getInstance()->getServer(); @@ -198,3 +179,5 @@ void CMigrateDialog::accept() QDialog::accept(); } + +#endif diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.h b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.h index 9cd584372..3c19bc6f4 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.h @@ -17,6 +17,8 @@ #ifndef MIGRATEDIALOG_H #define MIGRATEDIALOG_H +#if defined(Q_OS_WIN32) || defined(Q_MOC_RUN) + #include "ui_migratedialog.h" /** @@ -48,3 +50,5 @@ private: }; #endif + +#endif From 73e9806fe77f6520d2d9bbb0057d231093075e22 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 12:55:02 +0200 Subject: [PATCH 3/8] Changed: Return error message as an UTF-8 string --HG-- branch : develop --- code/nel/src/misc/debug.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 1f0bb4fd1..c9ac2f593 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -1429,22 +1429,27 @@ int getLastError() std::string formatErrorMessage(int errorCode) { #ifdef NL_OS_WINDOWS - LPVOID lpMsgBuf; - FormatMessage( + LPVOID lpMsgBuf = NULL; + DWORD len = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, + (LPWSTR) &lpMsgBuf, 0, NULL ); - string ret = (char*)lpMsgBuf; + // empty buffer, an error occured + if (len == 0) return toString("FormatMessage returned error %d", getLastError()); + + // convert wchar_t* to std::string + string ret = wideToUtf8(lpMsgBuf); + // Free the buffer. - LocalFree( lpMsgBuf ); + LocalFree(lpMsgBuf); return ret; #else From fccaee006b1b983974038c2991cb3d3e1f1f3a92 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 12:57:35 +0200 Subject: [PATCH 4/8] Changed: Only check if Ryzom is installed in current directory under Windows --HG-- branch : develop --- .../ryzom/tools/client/ryzom_installer/src/configfile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index c6b7a577d..437652599 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -839,8 +839,13 @@ OperationStep CConfigFile::getInstallNextStep() const // only show wizard if installation directory undefined if (getInstallationDirectory().isEmpty()) { + QString currentDirectory; + +#ifdef Q_OS_WIN32 + // only under Windows + // if launched from current directory, it means we just patched files - QString currentDirectory = getCurrentDirectory(); + currentDirectory = getCurrentDirectory(); if (!isRyzomInstalledIn(currentDirectory)) { @@ -852,6 +857,7 @@ OperationStep CConfigFile::getInstallNextStep() const currentDirectory.clear(); } } +#endif // install or migrate depending if Ryzom was found in current directory return currentDirectory.isEmpty() ? ShowInstallWizard:ShowMigrateWizard; From 0a502f64b2ebc5e91108b6091e6736217de8140a Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 12:58:23 +0200 Subject: [PATCH 5/8] Changed: More messages in log --HG-- branch : develop --- .../ryzom_installer/src/filescopier.cpp | 4 +- .../ryzom_installer/src/filesextractor.cpp | 41 ++++++++++++++++--- .../tools/client/ryzom_installer/src/main.cpp | 11 +++-- .../ryzom_installer/src/operationdialog.cpp | 15 +++---- .../client/ryzom_installer/src/profile.cpp | 4 +- .../ryzom_installer/src/profilesdialog.cpp | 2 +- .../client/ryzom_installer/src/utils.cpp | 2 +- 7 files changed, 57 insertions(+), 22 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp index b6ca5c4e9..1a8e6cfaf 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescopier.cpp @@ -182,12 +182,12 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files) if (!QFile::setPermissions(file.dst, file.permissions)) { - qDebug() << "Unable to change permissions of " << file.dst; + nlwarning("Unable to change permissions of %s", Q2C(file.dst)); } if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date)) { - qDebug() << "Unable to change date of " << file.dst; + nlwarning("Unable to change date of %s", Q2C(file.dst)); } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp index c0a446cb0..b66bf57a7 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filesextractor.cpp @@ -289,7 +289,7 @@ bool CFilesExtractor::exec() return extractBnp(); } - qDebug() << "Unsupported format"; + nlwarning("Unsupported format"); return false; } @@ -319,6 +319,8 @@ bool CFilesExtractor::extract7z() if (!inFile.open()) { + nlwarning("Unable to open %s", Q2C(m_sourceFile)); + if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(m_sourceFile)); return false; } @@ -451,14 +453,21 @@ bool CFilesExtractor::extract7z() if (res != SZ_OK) break; + QString destSubPath = QFileInfo(destPath).absolutePath(); + // create file directory - QDir().mkpath(QFileInfo(destPath).absolutePath()); + if (!QDir().mkpath(destSubPath)) + { + nlwarning("Unable to create directory %s", Q2C(destSubPath)); + } // create file QFile outFile(destPath); if (!outFile.open(QFile::WriteOnly)) { + nlwarning("Unable to open file %s", Q2C(destPath)); + error = QApplication::tr("Unable to open output file %1").arg(destPath); res = SZ_ERROR_FAIL; break; @@ -480,6 +489,8 @@ bool CFilesExtractor::extract7z() if (offset != outSizeProcessed) { + nlwarning("Unable to write output file %s (%u bytes written but expecting %u bytes)", Q2C(destPath), (uint32)offset, (uint32)outSizeProcessed); + error = QApplication::tr("Unable to write output file %1 (%2 bytes written but expecting %3 bytes)").arg(destPath).arg(offset).arg(outSizeProcessed); res = SZ_ERROR_FAIL; break; @@ -500,7 +511,7 @@ bool CFilesExtractor::extract7z() // set modification time if (!NLMISC::CFile::setFileModificationDate(qToUtf8(destPath), modificationTime)) { - qDebug() << "Unable to change date of " << destPath; + nlwarning("Unable to change date of %s", Q2C(destPath)); } } @@ -571,12 +582,16 @@ bool CFilesExtractor::extractZip() if (!baseDir.mkpath(fi.filePath)) { - if (m_listener) m_listener->operationFail(QApplication::tr("Unable to create directory %1").arg(absPath)); + nlwarning("Unable to create directory %s", Q2C(fi.filePath)); + + if (m_listener) m_listener->operationFail(QApplication::tr("Unable to create directory %1").arg(fi.filePath)); return false; } if (!QFile::setPermissions(absPath, fi.permissions)) { + nlwarning("Unable to change permissions of %s", Q2C(absPath)); + if (m_listener) m_listener->operationFail(QApplication::tr("Unable to set permissions of %1").arg(absPath)); return false; } @@ -609,19 +624,25 @@ bool CFilesExtractor::extractZip() if (!f.open(QIODevice::WriteOnly)) { + nlwarning("Unable to open %s", Q2C(absPath)); + if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(absPath)); return false; } currentSize += f.write(reader.fileData(fi.filePath)); - f.setPermissions(fi.permissions); + if (!f.setPermissions(fi.permissions)) + { + nlwarning("Unable to change permissions of %s", Q2C(absPath)); + } + f.close(); // set the right modification date if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t())) { - qDebug() << "Unable to change date of " << absPath; + nlwarning("Unable to change date of %s", Q2C(absPath)); } if (m_listener) m_listener->operationProgress(currentSize, QFileInfo(absPath).fileName()); @@ -692,18 +713,26 @@ bool CFilesExtractor::extractBnp() } catch(const NLMISC::EDiskFullError &e) { + nlwarning("Disk full when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory)); + error = QApplication::tr("disk full"); } catch(const NLMISC::EWriteError &e) { + nlwarning("Write error when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory)); + error = QApplication::tr("unable to write %1").arg(qFromUtf8(e.Filename)); } catch(const NLMISC::EReadError &e) { + nlwarning("Read error when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory)); + error = QApplication::tr("unable to read %1").arg(qFromUtf8(e.Filename)); } catch(const std::exception &e) { + nlwarning("Unknown exception when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory)); + error = QApplication::tr("failed (%1)").arg(qFromUtf8(e.what())); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 5279678db..499bd0198 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -64,13 +64,13 @@ bool copyInstallerFiles(const QStringList &files, const QString &destination) { if (!QFile::remove(dstPath)) { - qDebug() << "Unable to delete" << dstPath; + nlwarning("Unable to delete %s", Q2C(dstPath)); } } if (!QFile::copy(srcPath, dstPath)) { - qDebug() << "Unable to copy" << srcPath << "to" << dstPath; + nlwarning("Unable to copy %s to %s", Q2C(srcPath), Q2C(dstPath)); return false; } @@ -248,12 +248,15 @@ int main(int argc, char *argv[]) if (step == ShowMigrateWizard) { nlinfo("Display migration dialog"); - +#ifdef Q_OS_WIN32 CMigrateDialog dialog; if (!dialog.exec()) return 1; step = config.getInstallNextStep(); +#else + nlwarning("Migration disabled under Linux and OS X"); +#endif } else if (step == ShowInstallWizard) { @@ -307,6 +310,8 @@ int main(int argc, char *argv[]) #endif if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; + + nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath())); #endif } diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 75a0f49aa..f9e086c16 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -141,7 +141,7 @@ void COperationDialog::processInstallNextStep() if (m_operationStepCounter > 10) { - qDebug() << "possible infinite loop" << m_operationStep << m_operationStepCounter; + nlwarning("Possible infinite loop, step %s %d times", Q2C(stepToString(m_operationStep)), m_operationStepCounter); } switch(step) @@ -205,7 +205,8 @@ void COperationDialog::processInstallNextStep() default: // cases already managed in main.cpp - qDebug() << "Shouldn't happen, step" << step; + nlwarning("Shouldn't happen, step %s", Q2C(stepToString(step))); + break; } } @@ -706,14 +707,14 @@ void COperationDialog::launchUpgradeScript(const QString &directory, const QStri if (!QFile::setPermissions(upgradeScript, permissions)) { - qDebug() << "Unable to set executable flag to" << upgradeScript; + nlwarning("Unable to set executable flag to %s", Q2C(upgradeScript)); } process.start(upgradeScript); while (process.waitForFinished()) { - qDebug() << "waiting"; + nlwarning("Waiting end of %s", Q2C(upgradeScript)); } } @@ -764,7 +765,7 @@ void COperationDialog::copyInstaller() if (!path.isEmpty() && !QDir().mkpath(path)) { - qDebug() << "Unable to create directory" << path; + nlwarning("Unable to create directory %s", Q2C(path)); } // create installer link in menu @@ -785,7 +786,7 @@ void COperationDialog::copyInstaller() // create icon if not exists if (!QFile::exists(icon) && !writeResource(":/icons/ryzom.png", icon)) { - qDebug() << "Unable to create" << icon; + nlwarning("Unable to create icon %s", Q2C(icon)); } #endif @@ -1215,7 +1216,7 @@ void COperationDialog::deleteComponentsDownloadedFiles() { if (!QFile::remove(dir.filePath(file))) { - qDebug() << "Unable to delete" << file; + nlwarning("Unable to delete file %s", Q2C(file)); } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/profile.cpp b/code/ryzom/tools/client/ryzom_installer/src/profile.cpp index 90adb000c..bc90bba56 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profile.cpp @@ -128,7 +128,7 @@ void CProfile::createShortcuts() const // create desktop shortcut if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) { - qDebug() << "Unable to create desktop shortcut"; + nlwarning("Unable to create desktop shortcut"); } } @@ -142,7 +142,7 @@ void CProfile::createShortcuts() const // create menu shortcut if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) { - qDebug() << "Unable to create shortcut for client in menu"; + nlwarning("Unable to create shortcut for client in menu"); } } } diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index f15b44a45..dee751b48 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -94,7 +94,7 @@ void CProfilesDialog::onDeleteProfile() void CProfilesDialog::onProfileClicked(const QModelIndex &index) { - qDebug() << "clicked on" << index; + nlwarning("Clicked on profile %d", index.row()); displayProfile(index.row()); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 25f084726..1c0c291e8 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -192,7 +192,7 @@ bool createShortcut(const QString &shortcut, const QString &name, const QString if (FAILED(hres)) { - qDebug() << "Unable to create shortcut" << path; + nlwarning("Unable to create shortcut %s", Q2C(path)); } ppf->Release(); From 41fa1a938ee0cf396ff56f27f54ea409c0362993 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 14:26:31 +0200 Subject: [PATCH 6/8] Changed: More warnings --HG-- branch : develop --- .../client/ryzom_installer/src/utils.cpp | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 1c0c291e8..927b7f3b2 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -409,11 +409,18 @@ QString appendShortcutExtension(const QString &shortcut) QString getVersionFromExecutable(const QString &path) { // check if file exists - if (!QFile::exists(path)) return ""; + if (!QFile::exists(path)) + { + nlwarning("Unable to find %s", Q2C(path)); + return ""; + } #ifndef Q_OS_WIN32 // fix executable permissions under UNIX - QFile::setPermissions(path, QFile::permissions(path) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther); + if (!QFile::setPermissions(path, QFile::permissions(path) | QFile::ExeGroup | QFile::ExeUser | QFile::ExeOther)) + { + nlwarning("Unable to set executable permissions to %s", Q2C(path)); + } #endif // launch executable with --version argument @@ -421,14 +428,22 @@ QString getVersionFromExecutable(const QString &path) process.setProcessChannelMode(QProcess::MergedChannels); process.start(path, QStringList() << "--version", QIODevice::ReadWrite); - if (!process.waitForStarted()) return ""; + if (!process.waitForStarted()) + { + nlwarning("Unable to start %s", Q2C(path)); + return ""; + } QByteArray data; // read all output while (process.waitForReadyRead(1000)) data.append(process.readAll()); - if (!data.isEmpty()) + if (data.isEmpty()) + { + nlwarning("%s --version didn't return any data", Q2C(path)); + } + else { QString versionString = QString::fromUtf8(data); From 7ad0b610ba280e23c482a344ff65b5eb4eaa6a94 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 14:26:46 +0200 Subject: [PATCH 7/8] Changed: Open in ReadOnly the process --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index 927b7f3b2..fc6a2ff7c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -426,7 +426,7 @@ QString getVersionFromExecutable(const QString &path) // launch executable with --version argument QProcess process; process.setProcessChannelMode(QProcess::MergedChannels); - process.start(path, QStringList() << "--version", QIODevice::ReadWrite); + process.start(path, QStringList() << "--version", QIODevice::ReadOnly); if (!process.waitForStarted()) { From 552e147c76a3b3019d5ac67947a0d52ffa214fbe Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 14:27:05 +0200 Subject: [PATCH 8/8] Changed: If old installer doesn't return a version, overwrite it --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/configfile.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 437652599..043d9b130 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -692,6 +692,9 @@ int CConfigFile::compareInstallersVersion() const QString installedVersion = getVersionFromExecutable(installerDst); + // if unable to get version, copy it + if (installedVersion.isEmpty()) return 1; + nlinfo("%s version is %s", Q2C(installerDst), Q2C(installedVersion)); QString newVersion = QApplication::applicationVersion();