Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
runner: Always select the command first and don't match directories
Browse files Browse the repository at this point in the history
  • Loading branch information
amoskvin committed Sep 23, 2012
1 parent 625cb57 commit 1eed850
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion razorqt-runner/commanditemmodel.cpp
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions razorqt-runner/providers.cpp
Expand Up @@ -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 "";
Expand Down

0 comments on commit 1eed850

Please sign in to comment.