| 676 | } |
| 677 | |
| 678 | QString TWApp::findProgram(const QString& program, const QStringList& binPaths) |
| 679 | { |
| 680 | QStringListIterator pathIter(binPaths); |
| 681 | bool found = false; |
| 682 | QFileInfo fileInfo; |
| 683 | #if defined(Q_OS_WIN) |
| 684 | QStringList executableTypes = QStringList() << QString::fromLatin1("exe") << QString::fromLatin1("com") << QString::fromLatin1("cmd") << QString::fromLatin1("bat"); |
| 685 | #endif |
| 686 | while (pathIter.hasNext() && !found) { |
| 687 | QString path = pathIter.next(); |
| 688 | fileInfo = QFileInfo(path, program); |
| 689 | found = fileInfo.exists() && fileInfo.isExecutable(); |
| 690 | #if defined(Q_OS_WIN) |
| 691 | // try adding common executable extensions, if one was not already present |
| 692 | if (!found && !executableTypes.contains(fileInfo.suffix())) { |
| 693 | QStringListIterator extensions(executableTypes); |
| 694 | while (extensions.hasNext() && !found) { |
| 695 | fileInfo = QFileInfo(path, program + QChar::fromLatin1('.') + extensions.next()); |
| 696 | found = fileInfo.exists() && fileInfo.isExecutable(); |
| 697 | } |
| 698 | } |
| 699 | #endif |
| 700 | } |
| 701 | return found ? fileInfo.absoluteFilePath() : QString(); |
| 702 | } |
| 703 | |
| 704 | void TWApp::writeToMailingList() |
| 705 | { |
no test coverage detected