summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-06-24 10:15:16 +0200
committerKai Koehne <kai.koehne@theqtcompany.com>2015-06-24 09:22:42 +0000
commit1e589e37a991b29076e9a661f92dfa178421c208 (patch)
treeccdae70edb75b1bc17f0efc61086e16554e3f4eb /tools
parent65a5d4d33c7dcb27ce99ce59535733a28991c544 (diff)
Unify translated error messages
* Enclose file paths in "" * Localize file paths with QDir::toNativeSeparators. * Make sure sentences end with a '.' * Append error details always by ':', e.g. tr("Failed to copy file '%1': %2").(...) * Use 'directory' instead of 'folder' everywhere Change-Id: Ie045f429f72ad5045c96537465c5fb9d2e99d250 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/archivegen/archive.cpp11
-rw-r--r--tools/binarycreator/binarycreator.cpp16
-rw-r--r--tools/binarycreator/rcc/rcc.cpp10
-rw-r--r--tools/common/repositorygen.cpp78
-rw-r--r--tools/devtool/binarydump.cpp18
-rw-r--r--tools/devtool/binaryreplace.cpp22
-rw-r--r--tools/devtool/main.cpp12
-rw-r--r--tools/repocompare/repositorymanager.cpp5
-rw-r--r--tools/repogen/repogen.cpp6
9 files changed, 93 insertions, 85 deletions
diff --git a/tools/archivegen/archive.cpp b/tools/archivegen/archive.cpp
index b6ae31bfa..5a8f25f1f 100644
--- a/tools/archivegen/archive.cpp
+++ b/tools/archivegen/archive.cpp
@@ -39,6 +39,7 @@
#include <QCoreApplication>
#include <QCommandLineParser>
+#include <QDir>
#include <iostream>
@@ -82,19 +83,19 @@ private:
HRESULT OpenResult(const wchar_t *file, HRESULT result, const wchar_t*) {
if (result != S_OK) {
- printBlock(QCoreApplication::translate("archivegen", "Cannot update file: '%1'. "
- "Unsuporrted archive.").arg(QString::fromWCharArray(file)), Q_NULLPTR);
+ printBlock(QCoreApplication::translate("archivegen", "Cannot update file \"%1\". "
+ "Unsupported archive.").arg(QDir::toNativeSeparators(QString::fromWCharArray(file))), Q_NULLPTR);
}
return result;
}
HRESULT OpenFileError(const wchar_t *file, DWORD) {
- printBlock(QCoreApplication::translate("archivegen", "Cannot open file: "), file);
+ printBlock(QCoreApplication::translate("archivegen", "Cannot open file "), file);
return S_FALSE;
}
HRESULT CanNotFindError(const wchar_t *file, DWORD) {
- printBlock(QCoreApplication::translate("archivegen", "Cannot find file: "), file);
+ printBlock(QCoreApplication::translate("archivegen", "Cannot find file "), file);
return S_FALSE;
}
@@ -185,7 +186,7 @@ int main(int argc, char *argv[])
const int value = parser.value(compression).toInt(&ok);
if (!ok || (std::find(std::begin(values), std::end(values), value) == std::end(values))) {
throw QInstaller::Error(QCoreApplication::translate("archivegen",
- "Unknown compression level '%1'. See 'archivgen --help'.").arg(value));
+ "Unknown compression level \"%1\". See 'archivgen --help'.").arg(value));
}
Lib7z::initSevenZ();
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index b5df76601..4f400e6f2 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -199,7 +199,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
QTemporaryFile file(input.outputPath);
if (!file.open()) {
- throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(input.installerExePath,
+ throw Error(QString::fromLatin1("Cannot copy %1 to %2: %3").arg(input.installerExePath,
input.outputPath, file.errorString()));
}
@@ -209,7 +209,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
QFile instExe(input.installerExePath);
if (!instExe.copy(tempFile)) {
- throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(instExe.fileName(),
+ throw Error(QString::fromLatin1("Cannot copy %1 to %2: %3").arg(instExe.fileName(),
tempFile, instExe.errorString()));
}
@@ -252,7 +252,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
{
QFile target(targetName);
if (target.exists() && !target.remove()) {
- qCritical("Could not remove target %s: %s", qPrintable(target.fileName()),
+ qCritical("Cannot remove target %s: %s", qPrintable(target.fileName()),
qPrintable(target.errorString()));
QFile::remove(tempFile);
return EXIT_FAILURE;
@@ -265,7 +265,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
#ifdef Q_OS_OSX
if (!exe.copy(input.outputPath)) {
- throw Error(QString::fromLatin1("Could not copy %1 to %2: %3").arg(exe.fileName(),
+ throw Error(QString::fromLatin1("Cannot copy %1 to %2: %3").arg(exe.fileName(),
input.outputPath, exe.errorString()));
}
#else
@@ -297,7 +297,7 @@ static int assemble(Input input, const QInstaller::Settings &settings)
}
if (!out.rename(targetName)) {
- qCritical("Could not write installer to %s: %s", targetName.toUtf8().constData(),
+ qCritical("Cannot write installer to %s: %s", targetName.toUtf8().constData(),
out.errorString().toUtf8().constData());
QFile::remove(tempFile);
return EXIT_FAILURE;
@@ -373,7 +373,7 @@ static QSharedPointer<QInstaller::Resource> createDefaultResourceFile(const QStr
{
QTemporaryFile projectFile(directory + QLatin1String("/rccprojectXXXXXX.qrc"));
if (!projectFile.open())
- throw Error(QString::fromLatin1("Could not create temporary file for generated rcc project file"));
+ throw Error(QString::fromLatin1("Cannot create temporary file for generated rcc project file"));
projectFile.close();
const WorkingDirectoryChange wd(directory);
@@ -382,13 +382,13 @@ static QSharedPointer<QInstaller::Resource> createDefaultResourceFile(const QStr
// 1. create the .qrc file
if (runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-project") << QLatin1String("-o")
<< projectFileName) != EXIT_SUCCESS) {
- throw Error(QString::fromLatin1("Could not create rcc project file."));
+ throw Error(QString::fromLatin1("Cannot create rcc project file."));
}
// 2. create the binary resource file from the .qrc file
if (runRcc(QStringList() << QLatin1String("rcc") << QLatin1String("-binary") << QLatin1String("-o")
<< binaryName << projectFileName) != EXIT_SUCCESS) {
- throw Error(QString::fromLatin1("Could not compile rcc project file."));
+ throw Error(QString::fromLatin1("Cannot compile rcc project file."));
}
return QSharedPointer<QInstaller::Resource>(new QInstaller::Resource(binaryName, binaryName
diff --git a/tools/binarycreator/rcc/rcc.cpp b/tools/binarycreator/rcc/rcc.cpp
index 965c48f2e..3b5a6134a 100644
--- a/tools/binarycreator/rcc/rcc.cpp
+++ b/tools/binarycreator/rcc/rcc.cpp
@@ -714,25 +714,25 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
if (m_verbose)
m_errorDevice->write("Outputting code\n");
if (!writeHeader()) {
- m_errorDevice->write("Could not write header\n");
+ m_errorDevice->write("Cannot write header\n");
return false;
}
if (m_root) {
if (!writeDataBlobs()) {
- m_errorDevice->write("Could not write data blobs.\n");
+ m_errorDevice->write("Cannot write data blobs.\n");
return false;
}
if (!writeDataNames()) {
- m_errorDevice->write("Could not write file names\n");
+ m_errorDevice->write("Cannot write file names\n");
return false;
}
if (!writeDataStructure()) {
- m_errorDevice->write("Could not write data tree\n");
+ m_errorDevice->write("Cannot write data tree\n");
return false;
}
}
if (!writeInitializer()) {
- m_errorDevice->write("Could not write footer\n");
+ m_errorDevice->write("Cannot write footer\n");
return false;
}
outDevice.write(m_out.constData(), m_out.size());
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index a688742f7..5e1e348a8 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -77,7 +77,7 @@ QString QInstallerTools::makePathAbsolute(const QString &path)
void QInstallerTools::copyWithException(const QString &source, const QString &target, const QString &kind)
{
- qDebug() << QString::fromLatin1("Copying associated %1 file '%2'").arg(kind, source);
+ qDebug() << QString::fromLatin1("Copying associated %1 file \"%2\".").arg(kind, source);
const QFileInfo targetFileInfo(target);
if (!targetFileInfo.dir().exists())
@@ -86,8 +86,8 @@ void QInstallerTools::copyWithException(const QString &source, const QString &ta
QFile sourceFile(source);
if (!sourceFile.copy(target)) {
qDebug() << "failed!\n";
- throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file from\n'%2' to '%3'\nError: "
- "'%4'.").arg(kind, source, target,
+ throw QInstaller::Error(QString::fromLatin1("Cannot copy the %1 file from \"%2\" to \"%3\": "
+ "%4").arg(kind, QDir::toNativeSeparators(source), QDir::toNativeSeparators(target),
/* in case of an existing target the error String does not show the file */
(targetFileInfo.exists() ? QLatin1String("Target already exist.") : sourceFile.errorString())));
}
@@ -109,8 +109,8 @@ static QStringList copyFilesFromNode(const QString &parentNode, const QString &c
const QString filter = attr.isEmpty() ? node.toElement().text() : node.toElement().attribute(attr);
const QStringList files = dir.entryList(QStringList(filter), QDir::Files);
if (files.isEmpty()) {
- throw QInstaller::Error(QString::fromLatin1("Could not find any %1 matching '%2' "
- "while copying %1 of '%3'.").arg(kind, filter, info.name));
+ throw QInstaller::Error(QString::fromLatin1("Cannot find any %1 matching \"%2\" "
+ "while copying %1 of \"%3\".").arg(kind, filter, info.name));
}
foreach (const QString &file, files) {
@@ -160,10 +160,10 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
foreach (const PackageInfo &info, packages) {
if (!QDir(targetDir).mkpath(info.name))
- throw QInstaller::Error(QString::fromLatin1("Could not create directory '%1'.").arg(info.name));
+ throw QInstaller::Error(QString::fromLatin1("Cannot create directory \"%1\".").arg(info.name));
const QString packageXmlPath = QString::fromLatin1("%1/meta/package.xml").arg(info.directory);
- qDebug() << QString::fromLatin1("Copy meta data for package '%1' using '%2'.").arg(info.name,
+ qDebug() << QString::fromLatin1("Copy meta data for package \"%1\" using \"%2\".").arg(info.name,
packageXmlPath);
QFile file(packageXmlPath);
@@ -174,8 +174,8 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
int column = 0;
QDomDocument packageXml;
if (!packageXml.setContent(&file, &errMsg, &line, &column)) {
- throw QInstaller::Error(QString::fromLatin1("Could not parse '%1': line: %2, column: %3: %4 (%5)")
- .arg(packageXmlPath).arg(line).arg(column).arg(errMsg, info.name));
+ throw QInstaller::Error(QString::fromLatin1("Cannot parse \"%1\": line: %2, column: %3: %4 (%5)")
+ .arg(QDir::toNativeSeparators(packageXmlPath)).arg(line).arg(column).arg(errMsg, info.name));
}
QDomElement update = doc.createElement(QLatin1String("PackageUpdate"));
@@ -218,11 +218,11 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
if (foundDefault && foundVirtual) {
throw QInstaller::Error(QString::fromLatin1("Error: <Default> and <Virtual> elements are "
- "mutually exclusive. File: '%1'").arg(packageXmlPath));
+ "mutually exclusive in file \"%1\".").arg(QDir::toNativeSeparators(packageXmlPath)));
}
if (!foundDisplayName) {
- qWarning() << QString::fromLatin1("No DisplayName tag found at '%1', using component Name instead."
+ qWarning() << QString::fromLatin1("No DisplayName tag found at \"%1\", using component Name instead."
).arg(info.name);
QDomElement displayNameElement = doc.createElement(QLatin1String("DisplayName"));
update.appendChild(displayNameElement).appendChild(doc.createTextNode(info.name));
@@ -284,8 +284,8 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
if (!script.isEmpty()) {
QFile scriptFile(QString::fromLatin1("%1/meta/%2").arg(info.directory, script));
if (!scriptFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- throw QInstaller::Error(QString::fromLatin1("Could not open component script: '%1'")
- .arg(scriptFile.fileName()));
+ throw QInstaller::Error(QString::fromLatin1("Cannot open component script at \"%1\".")
+ .arg(QDir::toNativeSeparators(scriptFile.fileName())));
}
const QString scriptContent = QLatin1String("(function() {")
@@ -303,8 +303,9 @@ void QInstallerTools::copyMetaData(const QString &_targetDir, const QString &met
const QJSValue value = testScriptEngine.evaluate(scriptContent, scriptFile.fileName());
if (value.isError()) {
throw QInstaller::Error(QString::fromLatin1("Exception while loading component "
- "script: '%1'. (%2)").arg(scriptFile.fileName(), value.toString().isEmpty() ?
- QString::fromLatin1("Unknown error.") : value.toString()));
+ "script at \"%1\": %2").arg(QDir::toNativeSeparators(scriptFile.fileName()),
+ value.toString().isEmpty() ?
+ QString::fromLatin1("Unknown error.") : value.toString()));
}
const QString toLocation(QString::fromLatin1("%1/%2/%3").arg(targetDir, info.name, script));
@@ -396,14 +397,14 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
continue;
packagesToFilter->removeAll(it->fileName());
}
- qDebug() << QString::fromLatin1("found subdirectory '%1'").arg(it->fileName());
+ qDebug() << QString::fromLatin1("Found subdirectory \"%1\".").arg(it->fileName());
// because the filter is QDir::Dirs - filename means the name of the subdirectory
if (it->fileName().contains(QLatin1Char('-'))) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component '%1' must not contain '-'. This is not "
+ throw QInstaller::Error(QString::fromLatin1("Component \"%1\" must not contain '-'. This is not "
"allowed, because dashes are used as the separator between the component name and the "
- "version number internally.").arg(it->fileName()));
+ "version number internally.").arg(QDir::toNativeSeparators(it->fileName())));
}
QFile file(QString::fromLatin1("%1/meta/package.xml").arg(it->filePath()));
@@ -411,8 +412,8 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
if (!fileInfo.exists()) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component '%1' does not contain a package "
- "description (meta/package.xml is missing).").arg(it->fileName()));
+ throw QInstaller::Error(QString::fromLatin1("Component \"%1\" does not contain a package "
+ "description (meta/package.xml is missing).").arg(QDir::toNativeSeparators(it->fileName())));
}
file.open(QIODevice::ReadOnly);
@@ -424,21 +425,23 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
if (!doc.setContent(&file, &error, &errorLine, &errorColumn)) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component package description in '%1' is invalid. "
- "Error at line: %2, column: %3 -> %4").arg(fileInfo.absoluteFilePath(), QString::number(errorLine),
- QString::number(errorColumn), error));
+ throw QInstaller::Error(QString::fromLatin1("Component package description in \"%1\" is invalid. "
+ "Error at line: %2, column: %3 -> %4").arg(QDir::toNativeSeparators(fileInfo.absoluteFilePath()),
+ QString::number(errorLine),
+ QString::number(errorColumn), error));
}
const QDomElement packageElement = doc.firstChildElement(QLatin1String("Package"));
const QString name = packageElement.firstChildElement(QLatin1String("Name")).text();
if (!name.isEmpty() && name != it->fileName()) {
- qWarning() << QString::fromLatin1("The <Name> tag in the '%1' is ignored - the installer uses the "
- "path element right before the 'meta' ('%2').").arg(fileInfo.absoluteFilePath(), it->fileName());
+ qWarning() << QString::fromLatin1("The <Name> tag in the file \"%1\" is ignored - the installer uses the "
+ "path element right before the 'meta' (\"%2\").").arg(fileInfo.absoluteFilePath(),
+ it->fileName());
}
QString releaseDate = packageElement.firstChildElement(QLatin1String("ReleaseDate")).text();
if (releaseDate.isEmpty()) {
- qWarning("Release date for '%s' is empty! Using the current date instead.",
+ qWarning("Release date for \"%s\" is empty! Using the current date instead.",
qPrintable(fileInfo.absoluteFilePath()));
releaseDate = QDate::currentDate().toString(Qt::ISODate);
}
@@ -446,8 +449,9 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
if (!QDate::fromString(releaseDate, Qt::ISODate).isValid()) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Release date for '%1' is invalid! <ReleaseDate>%2"
- "</ReleaseDate>. Supported format: YYYY-MM-DD").arg(fileInfo.absoluteFilePath(), releaseDate));
+ throw QInstaller::Error(QString::fromLatin1("Release date for \"%1\" is invalid! <ReleaseDate>%2"
+ "</ReleaseDate>. Supported format: YYYY-MM-DD").arg(QDir::toNativeSeparators(fileInfo.absoluteFilePath()),
+ releaseDate));
}
PackageInfo info;
@@ -456,8 +460,8 @@ PackageInfoVector QInstallerTools::createListOfPackages(const QStringList &packa
if (!QRegExp(QLatin1String("[0-9]+((\\.|-)[0-9]+)*")).exactMatch(info.version)) {
if (ignoreInvalidPackages)
continue;
- throw QInstaller::Error(QString::fromLatin1("Component version for '%1' is invalid! <Version>%2</Version>")
- .arg(fileInfo.absoluteFilePath(), info.version));
+ throw QInstaller::Error(QString::fromLatin1("Component version for \"%1\" is invalid! <Version>%2</Version>")
+ .arg(QDir::toNativeSeparators(fileInfo.absoluteFilePath()), info.version));
}
info.dependencies = packageElement.firstChildElement(QLatin1String("Dependencies")).text()
.split(QInstaller::commaRegExp(), QString::SkipEmptyParts);
@@ -509,7 +513,7 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr
// use existing Updates.xml, if any
QFile existingUpdatesXml(QFileInfo(QDir(repoDir), QLatin1String("Updates.xml")).absoluteFilePath());
if (!existingUpdatesXml.open(QIODevice::ReadOnly) || !doc.setContent(&existingUpdatesXml)) {
- qDebug() << "Could not find Updates.xml";
+ qDebug() << "Cannot find Updates.xml";
} else {
root = doc.documentElement();
}
@@ -539,8 +543,8 @@ void QInstallerTools::compressMetaDirectories(const QString &repoDir, const QStr
writeSHA1ToNodeWithName(doc, elements, sha1Sum, path);
const QString finalTarget = absPath + QLatin1String("/") + fn;
if (!tmp.rename(finalTarget)) {
- throw QInstaller::Error(QString::fromLatin1("Could not move '%1' to '%2'").arg(tmpTarget,
- finalTarget));
+ throw QInstaller::Error(QString::fromLatin1("Cannot move file \"%1\" to \"%2\".").arg(
+ QDir::toNativeSeparators(tmpTarget), QDir::toNativeSeparators(finalTarget)));
}
}
@@ -559,7 +563,7 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
const QString namedRepoDir = QString::fromLatin1("%1/%2").arg(repoDir, name);
if (!QDir().mkpath(namedRepoDir)) {
- throw QInstaller::Error(QString::fromLatin1("Could not create repository folder for component '%1'")
+ throw QInstaller::Error(QString::fromLatin1("Cannot create repository directory for component \"%1\".")
.arg(name));
}
@@ -574,11 +578,11 @@ void QInstallerTools::copyComponentData(const QStringList &packageDirs, const QS
if (Lib7z::isSupportedArchive(absoluteEntryFilePath)) {
QFile tmp(absoluteEntryFilePath);
QString target = QString::fromLatin1("%1/%3%2").arg(namedRepoDir, entry, info.version);
- qDebug() << QString::fromLatin1("Copying archive from '%1' to '%2'").arg(tmp.fileName(),
+ qDebug() << QString::fromLatin1("Copying archive from \"%1\" to \"%2\".").arg(tmp.fileName(),
target);
if (!tmp.copy(target)) {
- throw QInstaller::Error(QString::fromLatin1("Could not copy '%1' to '%2': %3")
- .arg(tmp.fileName(), target, tmp.errorString()));
+ throw QInstaller::Error(QString::fromLatin1("Cannot copy file \"%1\" to \"%2\": %3")
+ .arg(QDir::toNativeSeparators(tmp.fileName()), QDir::toNativeSeparators(target), tmp.errorString()));
}
compressedFiles.append(target);
} else {
diff --git a/tools/devtool/binarydump.cpp b/tools/devtool/binarydump.cpp
index a0ff4f74e..f8bb23996 100644
--- a/tools/devtool/binarydump.cpp
+++ b/tools/devtool/binarydump.cpp
@@ -48,14 +48,14 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
QDir targetDir(QFileInfo(target).absoluteFilePath());
if (targetDir.exists()) {
if (!targetDir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
- std::cerr << qPrintable(QString::fromLatin1("Target directory '%1' already exists and "
- "is not empty.").arg(targetDir.path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Target directory \"%1\" already exists and "
+ "is not empty.").arg(QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
} else {
if (!QDir().mkpath(targetDir.path())) {
- std::cerr << qPrintable(QString::fromLatin1("Could not create '%1'.").arg(targetDir
- .path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot create \"%1\".").arg(
+ QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
}
@@ -69,8 +69,8 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
}
if (!targetDir.cd(QLatin1String("metadata"))) {
- std::cerr << qPrintable(QString::fromLatin1("Could not switch to '%1/metadata'.")
- .arg(targetDir.path())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot switch to \"%1/metadata\".")
+ .arg(QDir::toNativeSeparators(targetDir.path()))) << std::endl;
return EXIT_FAILURE;
}
@@ -82,8 +82,8 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
QString error;
QDomDocument doc;
if (!doc.setContent(&updatesXml, &error)) {
- throw QInstaller::Error(QString::fromLatin1("Could not read: '%1'. %2").arg(updatesXml
- .fileName(), error));
+ throw QInstaller::Error(QString::fromLatin1("Cannot read: \"%1\": %2").arg(
+ QDir::toNativeSeparators(updatesXml.fileName()), error));
}
QHash<QString, QString> versionMap;
@@ -114,7 +114,7 @@ int BinaryDump::dump(const QInstaller::ResourceCollectionManager &manager, const
continue;
if (!targetDir.mkpath(name)) {
- throw QInstaller::Error(QString::fromLatin1("Could not create target dir: %1.")
+ throw QInstaller::Error(QString::fromLatin1("Cannot create target dir: %1.")
.arg(targetDir.filePath(name)));
}
diff --git a/tools/devtool/binaryreplace.cpp b/tools/devtool/binaryreplace.cpp
index 3e6144e39..b62ad58de 100644
--- a/tools/devtool/binaryreplace.cpp
+++ b/tools/devtool/binaryreplace.cpp
@@ -84,19 +84,19 @@ int BinaryReplace::replace(const QString &source, const QString &target)
.path;
result = EXIT_SUCCESS;
} catch (const Lib7z::SevenZipException& e) {
- std::cerr << qPrintable(QString::fromLatin1("Error while extracting '%1': %2.")
- .arg(newInstallerBasePath, e.message())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Error while extracting \"%1\": %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), e.message())) << std::endl;
} catch (...) {
std::cerr << qPrintable(QString::fromLatin1("Unknown exception caught while "
- "extracting '%1'.").arg(newInstallerBasePath)) << std::endl;
+ "extracting \"%1\".").arg(QDir::toNativeSeparators(newInstallerBasePath))) << std::endl;
}
} else {
- std::cerr << qPrintable(QString::fromLatin1("Could not open '%1' for reading: %2.")
- .arg(newInstallerBasePath, archive.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot open \"%1\" for reading: %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), archive.errorString())) << std::endl;
}
if (!archive.remove()) {
- std::cerr << qPrintable(QString::fromLatin1("Could not delete file '%1': %2.")
- .arg(newInstallerBasePath, archive.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot delete file \"%1\": %2")
+ .arg(QDir::toNativeSeparators(newInstallerBasePath), archive.errorString())) << std::endl;
}
if (result != EXIT_SUCCESS)
return result;
@@ -133,19 +133,19 @@ int BinaryReplace::replace(const QString &source, const QString &target)
#endif
QFile backup(installerBaseOld.fileName() + QLatin1String(".bak"));
if (backup.exists() && (!backup.remove())) {
- std::cerr << qPrintable(QString::fromLatin1("Could not delete '%1'. %2")
- .arg(backup.fileName(), backup.errorString())) << std::endl;
+ std::cerr << qPrintable(QString::fromLatin1("Cannot delete \"%1\": %2")
+ .arg(QDir::toNativeSeparators(backup.fileName()), backup.errorString())) << std::endl;
}
const QString oldBasePath = installerBaseOld.fileName();
if (!installerBaseOld.rename(oldBasePath + QLatin1String(".bak"))) {
- std::cerr << qPrintable(QString::fromLatin1("Could not rename '%1' to '%2'. %3")
+ std::cerr << qPrintable(QString::fromLatin1("Cannot rename \"%1\" to \"%2\": %3")
.arg(oldBasePath, oldBasePath + QLatin1String(".bak"),
installerBaseOld.errorString())) << std::endl;
}
if (!installerBaseNew.rename(oldBasePath)) {
- std::cerr << qPrintable(QString::fromLatin1("Could not copy '%1' to '%2'. %3")
+ std::cerr << qPrintable(QString::fromLatin1("Cannot copy \"%1\" to \"%2\": %3")
.arg(installerBaseNew.fileName(), oldBasePath, installerBaseNew.errorString()))
<< std::endl;
} else {
diff --git a/tools/devtool/main.cpp b/tools/devtool/main.cpp
index 638242b29..ff7551fed 100644
--- a/tools/devtool/main.cpp
+++ b/tools/devtool/main.cpp
@@ -61,8 +61,8 @@ struct Command
const char* argDescription;
} Commands[] = {
{ "dump", "Dumps the binary content that belongs to an installer or maintenance tool into "
- "target folder.", 2, "<binary> <targetfolder>", "The <binary> containing the data to "
- "dump.\nThe <targetfolder> to dump the data in."
+ "target directory.", 2, "<binary> <targetdirecory>", "The <binary> containing the data to "
+ "dump.\nThe <targetdirectory> to dump the data in."
},
{ "update", "Updates existing installer or maintenance tool with a new installer base.", 2,
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
parser.showHelp(EXIT_SUCCESS);
}
}
- return fail(QString::fromLatin1("'%1' is not a devtool command.").arg(command));
+ return fail(QString::fromLatin1("\"%1\" is not a devtool command.").arg(command));
}
QString helpText = parser.helpText();
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
}
if (!found)
- return fail(QString::fromLatin1("'%1' is not a devtool command.").arg(command));
+ return fail(QString::fromLatin1("\"%1\" is not a devtool command.").arg(command));
QInstaller::init();
QInstaller::setVerbose(parser.isSet(verbose));
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
QInstaller::openForRead(&tmp);
if (!tmp.seek(QInstaller::BinaryContent::findMagicCookie(&tmp, cookie) - sizeof(qint64)))
- throw QInstaller::Error(QLatin1String("Could not seek to read magic marker."));
+ throw QInstaller::Error(QLatin1String("Cannot seek to read magic marker."));
QInstaller::BinaryLayout layout;
layout.magicMarker = QInstaller::retrieveInt64(&tmp);
@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
const QByteArray ba = resource->readAll();
if (!QResource::registerResource((const uchar*) ba.data(), QLatin1String(":/metadata")))
- throw QInstaller::Error(QLatin1String("Could not register in-binary resource."));
+ throw QInstaller::Error(QLatin1String("Cannot register in-binary resource."));
resourceMappings.append(ba);
if (!isOpen)
resource->close();
diff --git a/tools/repocompare/repositorymanager.cpp b/tools/repocompare/repositorymanager.cpp
index 8f69432dc..9faf72319 100644
--- a/tools/repocompare/repositorymanager.cpp
+++ b/tools/repocompare/repositorymanager.cpp
@@ -34,6 +34,7 @@
#include "repositorymanager.h"
#include <QDebug>
+#include <QDir>
#include <QFile>
#include <QStringList>
#include <QUrl>
@@ -186,7 +187,9 @@ void RepositoryManager::writeUpdateFile(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) {
- QMessageBox::critical(0, QLatin1String("Error"), QLatin1String("Could not open File for saving"));
+ QMessageBox::critical(0, QLatin1String("Error"),
+ QString::fromLatin1("Cannot open file \"%1\" for writing: %2").arg(
+ QDir::toNativeSeparators(fileName), file.errorString()));
return;
}
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index a1fe5548d..7554cfa20 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -193,7 +193,7 @@ int main(int argc, char** argv)
QDir::AllEntries | QDir::NoDotAndDotDot).isEmpty()) {
throw QInstaller::Error(QCoreApplication::translate("QInstaller",
- "Repository target folder %1 already exists!").arg(repositoryDir));
+ "Repository target directory \"%1\" already exists.").arg(QDir::toNativeSeparators(repositoryDir)));
}
QInstallerTools::PackageInfoVector packages = QInstallerTools::createListOfPackages(packagesDirectories,
@@ -206,7 +206,7 @@ int main(int argc, char** argv)
const QDomElement root = doc.documentElement();
if (root.tagName() != QLatin1String("Updates")) {
throw QInstaller::Error(QCoreApplication::translate("QInstaller",
- "Invalid content in '%1'.").arg(file.fileName()));
+ "Invalid content in \"%1\".").arg(QDir::toNativeSeparators(file.fileName())));
}
file.close(); // close the file, we read the content already
@@ -239,7 +239,7 @@ int main(int argc, char** argv)
}
if (packages.isEmpty()) {
- std::cout << QString::fromLatin1("Could not find new components to update '%1'.")
+ std::cout << QString::fromLatin1("Cannot find new components to update \"%1\".")
.arg(repositoryDir) << std::endl;
return EXIT_SUCCESS;
}