Check isFile in order not to find usr/share/appname

https://travis-ci.org/probonopd/QOwnNotes/builds/208396925
This commit is contained in:
probonopd
2017-03-07 00:29:41 +01:00
committed by GitHub
parent 9359693d9f
commit 12f43f60d1
+3 -3
View File
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
QDirIterator it(directoryToBeSearched, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
if((it.fileName() == desktopExecEntry) && (it.fileInfo().isExecutable())){
if((it.fileName() == desktopExecEntry) && (it.fileInfo().isFile()) && (it.fileInfo().isExecutable())){
qDebug() << "Found binary from desktop file:" << it.fileInfo().canonicalFilePath();
appBinaryPath = it.fileInfo().absoluteFilePath();
break;
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
QDirIterator it2(directoryToBeSearched, QDirIterator::Subdirectories);
while (it2.hasNext()) {
it2.next();
if((it2.fileName() == desktopExecEntry) && (it2.fileInfo().isExecutable())){
if((it2.fileName() == desktopExecEntry) && (it.fileInfo().isFile()) && (it2.fileInfo().isExecutable())){
qDebug() << "Found binary from desktop file:" << it2.fileInfo().canonicalFilePath();
appBinaryPath = it2.fileInfo().absoluteFilePath();
break;
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
}
if(appBinaryPath == ""){
if(QFileInfo(candidateBin).isExecutable()) {
if((QFileInfo(candidateBin).isFile()) && (QFileInfo(candidateBin).isExecutable())) {
appBinaryPath = QFileInfo(candidateBin).absoluteFilePath();
} else {
LogError() << "Could not determine the path to the executable based on the desktop file\n";