Changed: More messages in log

This commit is contained in:
kervala 2016-10-21 12:58:23 +02:00
parent 2f0bf8a69f
commit b4955955bc
7 changed files with 57 additions and 22 deletions

View file

@ -182,12 +182,12 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
if (!QFile::setPermissions(file.dst, file.permissions)) 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)) 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));
} }
} }

View file

@ -289,7 +289,7 @@ bool CFilesExtractor::exec()
return extractBnp(); return extractBnp();
} }
qDebug() << "Unsupported format"; nlwarning("Unsupported format");
return false; return false;
} }
@ -319,6 +319,8 @@ bool CFilesExtractor::extract7z()
if (!inFile.open()) 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)); if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(m_sourceFile));
return false; return false;
} }
@ -451,14 +453,21 @@ bool CFilesExtractor::extract7z()
if (res != SZ_OK) break; if (res != SZ_OK) break;
QString destSubPath = QFileInfo(destPath).absolutePath();
// create file directory // create file directory
QDir().mkpath(QFileInfo(destPath).absolutePath()); if (!QDir().mkpath(destSubPath))
{
nlwarning("Unable to create directory %s", Q2C(destSubPath));
}
// create file // create file
QFile outFile(destPath); QFile outFile(destPath);
if (!outFile.open(QFile::WriteOnly)) if (!outFile.open(QFile::WriteOnly))
{ {
nlwarning("Unable to open file %s", Q2C(destPath));
error = QApplication::tr("Unable to open output file %1").arg(destPath); error = QApplication::tr("Unable to open output file %1").arg(destPath);
res = SZ_ERROR_FAIL; res = SZ_ERROR_FAIL;
break; break;
@ -480,6 +489,8 @@ bool CFilesExtractor::extract7z()
if (offset != outSizeProcessed) 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); 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; res = SZ_ERROR_FAIL;
break; break;
@ -500,7 +511,7 @@ bool CFilesExtractor::extract7z()
// set modification time // set modification time
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(destPath), modificationTime)) 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 (!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; return false;
} }
if (!QFile::setPermissions(absPath, fi.permissions)) 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)); if (m_listener) m_listener->operationFail(QApplication::tr("Unable to set permissions of %1").arg(absPath));
return false; return false;
} }
@ -609,19 +624,25 @@ bool CFilesExtractor::extractZip()
if (!f.open(QIODevice::WriteOnly)) 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)); if (m_listener) m_listener->operationFail(QApplication::tr("Unable to open %1").arg(absPath));
return false; return false;
} }
currentSize += f.write(reader.fileData(fi.filePath)); 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(); f.close();
// set the right modification date // set the right modification date
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t())) 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()); if (m_listener) m_listener->operationProgress(currentSize, QFileInfo(absPath).fileName());
@ -692,18 +713,26 @@ bool CFilesExtractor::extractBnp()
} }
catch(const NLMISC::EDiskFullError &e) catch(const NLMISC::EDiskFullError &e)
{ {
nlwarning("Disk full when extracting %s to %s", Q2C(m_sourceFile), Q2C(m_destinationDirectory));
error = QApplication::tr("disk full"); error = QApplication::tr("disk full");
} }
catch(const NLMISC::EWriteError &e) 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)); error = QApplication::tr("unable to write %1").arg(qFromUtf8(e.Filename));
} }
catch(const NLMISC::EReadError &e) 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)); error = QApplication::tr("unable to read %1").arg(qFromUtf8(e.Filename));
} }
catch(const std::exception &e) 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())); error = QApplication::tr("failed (%1)").arg(qFromUtf8(e.what()));
} }

View file

@ -64,13 +64,13 @@ bool copyInstallerFiles(const QStringList &files, const QString &destination)
{ {
if (!QFile::remove(dstPath)) if (!QFile::remove(dstPath))
{ {
qDebug() << "Unable to delete" << dstPath; nlwarning("Unable to delete %s", Q2C(dstPath));
} }
} }
if (!QFile::copy(srcPath, 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; return false;
} }
@ -248,12 +248,15 @@ int main(int argc, char *argv[])
if (step == ShowMigrateWizard) if (step == ShowMigrateWizard)
{ {
nlinfo("Display migration dialog"); nlinfo("Display migration dialog");
#ifdef Q_OS_WIN32
CMigrateDialog dialog; CMigrateDialog dialog;
if (!dialog.exec()) return 1; if (!dialog.exec()) return 1;
step = config.getInstallNextStep(); step = config.getInstallNextStep();
#else
nlwarning("Migration disabled under Linux and OS X");
#endif
} }
else if (step == ShowInstallWizard) else if (step == ShowInstallWizard)
{ {
@ -307,6 +310,8 @@ int main(int argc, char *argv[])
#endif #endif
if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0; if (QProcess::startDetached(config.getInstallerInstalledFilePath())) return 0;
nlwarning("Unable to restart Installer %s", Q2C(config.getInstallerInstalledFilePath()));
#endif #endif
} }

View file

@ -141,7 +141,7 @@ void COperationDialog::processInstallNextStep()
if (m_operationStepCounter > 10) 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) switch(step)
@ -205,7 +205,8 @@ void COperationDialog::processInstallNextStep()
default: default:
// cases already managed in main.cpp // cases already managed in main.cpp
qDebug() << "Shouldn't happen, step" << step; nlwarning("Shouldn't happen, step %s", Q2C(stepToString(step)));
break; break;
} }
} }
@ -706,14 +707,14 @@ void COperationDialog::launchUpgradeScript(const QString &directory, const QStri
if (!QFile::setPermissions(upgradeScript, permissions)) 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); process.start(upgradeScript);
while (process.waitForFinished()) 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)) 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 // create installer link in menu
@ -785,7 +786,7 @@ void COperationDialog::copyInstaller()
// create icon if not exists // create icon if not exists
if (!QFile::exists(icon) && !writeResource(":/icons/ryzom.png", icon)) if (!QFile::exists(icon) && !writeResource(":/icons/ryzom.png", icon))
{ {
qDebug() << "Unable to create" << icon; nlwarning("Unable to create icon %s", Q2C(icon));
} }
#endif #endif
@ -1215,7 +1216,7 @@ void COperationDialog::deleteComponentsDownloadedFiles()
{ {
if (!QFile::remove(dir.filePath(file))) if (!QFile::remove(dir.filePath(file)))
{ {
qDebug() << "Unable to delete" << file; nlwarning("Unable to delete file %s", Q2C(file));
} }
} }

View file

@ -128,7 +128,7 @@ void CProfile::createShortcuts() const
// create desktop shortcut // create desktop shortcut
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) 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 // create menu shortcut
if (!createShortcut(shortcut, name, exe, profileArguments, icon, workingDir)) 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");
} }
} }
} }

View file

@ -94,7 +94,7 @@ void CProfilesDialog::onDeleteProfile()
void CProfilesDialog::onProfileClicked(const QModelIndex &index) void CProfilesDialog::onProfileClicked(const QModelIndex &index)
{ {
qDebug() << "clicked on" << index; nlwarning("Clicked on profile %d", index.row());
displayProfile(index.row()); displayProfile(index.row());
} }

View file

@ -192,7 +192,7 @@ bool createShortcut(const QString &shortcut, const QString &name, const QString
if (FAILED(hres)) if (FAILED(hres))
{ {
qDebug() << "Unable to create shortcut" << path; nlwarning("Unable to create shortcut %s", Q2C(path));
} }
ppf->Release(); ppf->Release();