25 #include "serverapi/gamefile.h" 28 #include <QStringList> 30 QString PathFind::findExe(
const PathFinder &pathFinder,
const QString &name)
32 #if defined(Q_OS_WIN32) 33 if (!name.endsWith(
".exe"))
35 QString file = pathFinder.
findFile(name +
".exe");
45 QString PathFind::findGameFile(
const QStringList &knownPaths,
const GameFile &gameFile)
48 QStringList knownDirs;
49 for (
const QString &path : knownPaths)
51 if (!path.trimmed().isEmpty())
53 QFileInfo fileInfo(path);
58 if (fileInfo.dir().exists())
64 return findGameFile(pathFinder, gameFile);
71 return findExe(pathFinder, gameFile.
fileName());
Performs a case-insensitive (OS independent) file searches.
int executable() const
Executable bit flags mod that compares to ExecType.
QStringList & searchSuffixes() const
Path suffixes that help in automatically finding this file.
Game file definition allows to browse this file in configuration box.
const QString & fileName() const
Name of the file on disk.
QString findFile(const QString &fileName) const
Performs a search for a single file.
static PathFinder genericPathFinder(const QStringList &suffixes)
Generic PathFinder that looks in PATH and other common dirs.
void addPrioritySearchDir(const QString &dir)