2 * This file is a part of QComicBook.
4 * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
6 * QComicBook is free software; you can redestribute it and/or modify it
7 * under terms of GNU General Public License by Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY. See GPL for more details.
14 #include <qstringlist.h>
15 #include <qfileinfo.h>
18 QString Utility::which(const QString &command)
20 const QString paths = QString(getenv("PATH"));
21 QStringList plist = QStringList::split(":", paths, false);
22 for (QStringList::const_iterator it = plist.begin(); it != plist.end(); it++)
24 QFileInfo finfo(*it + "/" + command);
25 if (finfo.isExecutable())
26 return finfo.absFilePath();