MCPcopy Create free account
hub / github.com/TeXworks/texworks / findProgram

Method findProgram

src/TWApp.cpp:678–702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678QString 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
704void TWApp::writeToMailingList()
705{

Callers 1

programPathMethod · 0.80

Calls 2

containsMethod · 0.80
absoluteFilePathMethod · 0.45

Tested by

no test coverage detected