From 50677485f777a8f66b949bfc313ddb43bb58aad3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 16 Feb 2015 13:20:05 -0800 Subject: [PATCH] qtplugininfo: Always print the tool name and the filename first Like moc and cat: $ cat foo cat: foo: No such file or directory $ moc foo moc: foo: No such file Change-Id: I1a800c709d3543699131ffff13c37f0dfdeefc5c Reviewed-by: Friedemann Kleint --- src/qtplugininfo/qtplugininfo.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qtplugininfo/qtplugininfo.cpp b/src/qtplugininfo/qtplugininfo.cpp index d57284a..e3019c7 100644 --- a/src/qtplugininfo/qtplugininfo.cpp +++ b/src/qtplugininfo/qtplugininfo.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -57,17 +58,19 @@ int main(int argc, char** argv) parser.showHelp(1); foreach (const QString &plugin, parser.positionalArguments()) { + QByteArray pluginNativeName = QFile::encodeName(QDir::toNativeSeparators(plugin)); if (!QFile::exists(plugin)) { - std::cerr << "File " << qPrintable(plugin) << " does not exist." << std::endl; + std::cerr << "qtplugininfo: " << pluginNativeName.constData() << ": No such file or directory." << std::endl; return 1; } if (!QLibrary::isLibrary(plugin)) { - std::cerr << "File " << qPrintable(plugin) << " is not a plug-in." << std::endl; + std::cerr << "qtplugininfo: " << pluginNativeName.constData() << ": Not a plug-in." << std::endl; return 1; } QPluginLoader loader(plugin); if (loader.metaData().isEmpty()) { - std::cerr << "No plug-in meta-data found: " << qPrintable(loader.errorString()) << std::endl; + std::cerr << "qtplugininfo: " << pluginNativeName.constData() << ": No plug-in meta-data found: " + << qPrintable(loader.errorString()) << std::endl; return 1; } const QJsonDocument doc(loader.metaData()); -- 2.7.4