Skip to content
Browse files

runner: Always select the command first and don't match directories

  • Loading branch information...
1 parent 625cb57 commit 1eed850a07e22b8a2b847ff4beeb8988517864d4 @amoskvin amoskvin committed Sep 23, 2012
Showing with 7 additions and 5 deletions.
  1. +1 −1 razorqt-runner/commanditemmodel.cpp
  2. +6 −4 razorqt-runner/providers.cpp
View
2 razorqt-runner/commanditemmodel.cpp
@@ -143,7 +143,7 @@ QModelIndex CommandItemModel::appropriateItem(const QString &pattern) const
QModelIndex ind = index(i,0);
QModelIndex srcIndex = mapToSource(ind);
if (srcIndex == mSourceModel->customCommandIndex())
- continue;
+ return ind;
const CommandProviderItem *item = mSourceModel->command(srcIndex);
if (!item)
View
10 razorqt-runner/providers.cpp
@@ -410,16 +410,18 @@ QString which(const QString &progName)
if (progName.startsWith(QDir::separator()))
{
- if (QFileInfo(progName).isExecutable())
- QFileInfo(progName).absoluteFilePath();
+ QFileInfo fileInfo(progName);
+ if (fileInfo.isExecutable() && fileInfo.isFile())
+ return fileInfo.absoluteFilePath();
}
QStringList dirs = QString(getenv("PATH")).split(":");
foreach (QString dir, dirs)
{
- if (QFileInfo(QDir(dir), progName).isExecutable())
- return QFileInfo(QDir(dir), progName).absoluteFilePath();
+ QFileInfo fileInfo(QDir(dir), progName);
+ if (fileInfo.isExecutable() && fileInfo.isFile())
+ return fileInfo.absoluteFilePath();
}
return "";

0 comments on commit 1eed850

Please sign in to comment.
Something went wrong with that request. Please try again.