Changed: More warnings
This commit is contained in:
parent
a45d723334
commit
aa42c17fed
1 changed files with 19 additions and 4 deletions
|
@ -409,11 +409,18 @@ QString appendShortcutExtension(const QString &shortcut)
|
||||||
QString getVersionFromExecutable(const QString &path)
|
QString getVersionFromExecutable(const QString &path)
|
||||||
{
|
{
|
||||||
// check if file exists
|
// 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
|
#ifndef Q_OS_WIN32
|
||||||
// fix executable permissions under UNIX
|
// 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
|
#endif
|
||||||
|
|
||||||
// launch executable with --version argument
|
// launch executable with --version argument
|
||||||
|
@ -421,14 +428,22 @@ QString getVersionFromExecutable(const QString &path)
|
||||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||||
process.start(path, QStringList() << "--version", QIODevice::ReadWrite);
|
process.start(path, QStringList() << "--version", QIODevice::ReadWrite);
|
||||||
|
|
||||||
if (!process.waitForStarted()) return "";
|
if (!process.waitForStarted())
|
||||||
|
{
|
||||||
|
nlwarning("Unable to start %s", Q2C(path));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
|
||||||
// read all output
|
// read all output
|
||||||
while (process.waitForReadyRead(1000)) data.append(process.readAll());
|
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);
|
QString versionString = QString::fromUtf8(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue