When looking for an executable on the PATH we would mistakenly
report directories with the same filename (like "ant") as
the correct executable.
Task-number: QTBUG-33907
Change-Id: I7122e6f8da7a3027666e9dfc3040a17c2876e981
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
QStringList paths = path.split(separator);
foreach (QString path, paths) {
- if (QFile::exists(path + QLatin1Char('/') + fileName))
+ QFileInfo fileInfo(path + QLatin1Char('/') + fileName);
+ if (fileInfo.exists() && fileInfo.isFile() && fileInfo.isExecutable())
return path + QLatin1Char('/') + fileName;
}