From a45d723334b168235b2fc57482fcbc87cbef7321 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 21 Oct 2016 12:58:23 +0200 Subject: [PATCH] Changed: More messages in log --- .../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();