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");
46 QString PathFind::findGameFile(
const QStringList &knownPaths,
const GameFile &gameFile)
49 QStringList knownDirs;
50 foreach (
const QString &path, knownPaths)
52 if (!path.trimmed().isEmpty())
54 QFileInfo fileInfo(path);
59 if (fileInfo.dir().exists())
65 return findGameFile(pathFinder, gameFile);
72 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)