PathFinder Class Reference

Performs a case-insensitive (OS independent) file searches. More...

#include <pathfinder.h>

Public Member Functions

 PathFinder ()
 Constructs PathFinder where paths are read from program configuration from file (WAD) path list setting. More...
 
 PathFinder (const QStringList &paths)
 Constructs PathFinder with custom paths. More...
 
void addPrioritySearchDir (const QString &dir)
 
void addSearchDir (const QString &dir)
 Adds directory where search will be performed. More...
 
QString findFile (const QString &fileName) const
 Performs a search for a single file. More...
 
PathFinderResult findFiles (const QStringList &files) const
 Performs a search for multiple files, marking them as found or missing. More...
 

Static Public Member Functions

static PathFinder genericPathFinder (const QStringList &suffixes)
 Generic PathFinder that looks in PATH and other common dirs. More...
 

Detailed Description

Performs a case-insensitive (OS independent) file searches.

This object is copyable.

On case-insensitive file systems (like NTFS) the search is simple and doesn't differ from what one would expect of the system tools to do.

On case-sensitive file systems (Linux FS-es) the search goes against the principles of the OS and treats files with alternating letter case the same. So, on Linux doom2.wad, DOOM2.WAD and doom2.WAD are all treated as equal. If more than one file is present in a searched directory, only one path is returned and it's undefined which one will it be.

Search is performed in a set of paths retrieved from configuration or specified manually through constructor and addPrioritySearchDir().

Definition at line 81 of file pathfinder.h.

Constructor & Destructor Documentation

PathFinder::PathFinder ( )

Constructs PathFinder where paths are read from program configuration from file (WAD) path list setting.

PathFinder::PathFinder ( const QStringList &  paths)

Constructs PathFinder with custom paths.

Program configuration is skipped here.

Definition at line 113 of file pathfinder.cpp.

Member Function Documentation

void PathFinder::addPrioritySearchDir ( const QString &  dir)

Provides a directory where we should search first before going to user specified locations. This function can take either a directory or a file as its input. If a file is given the directory part will be extracted.

Definition at line 150 of file pathfinder.cpp.

void PathFinder::addSearchDir ( const QString &  dir)

Adds directory where search will be performed.

Directory is added with least search priority. If you wish to add dir with top priority use addPrioritySearchDir() instead.

Definition at line 156 of file pathfinder.cpp.

QString PathFinder::findFile ( const QString &  fileName) const

Performs a search for a single file.

Definition at line 162 of file pathfinder.cpp.

PathFinderResult PathFinder::findFiles ( const QStringList &  files) const

Performs a search for multiple files, marking them as found or missing.

Definition at line 171 of file pathfinder.cpp.

PathFinder PathFinder::genericPathFinder ( const QStringList &  suffixes)
static

Generic PathFinder that looks in PATH and other common dirs.

This PathFinder is suitable for finding game executables. What dirs are searched depends on the platform.

Definition at line 125 of file pathfinder.cpp.


The documentation for this class was generated from the following files: