Handles searching a list of paths for a file.  
 More...
#include <SearchPath.hpp>
|  | 
| enum | target_type_t { kFindFile,
 kFindDirectory
 }
 | 
|  | 
|  | 
|  | PathSearcher () | 
|  | Constructor. 
 | 
|  | 
| void | addSearchPath (const std::string &path) | 
|  | Add a new search path to the end of the list. 
 | 
|  | 
| void | setTempPath (const std::string &path) | 
|  | Set temporary path. 
 | 
|  | 
| bool | search (const std::string &base, target_type_t targetType, bool searchCwd, std::string &result) | 
|  | Attempts to locate a file by using the search paths.  More... 
 | 
|  | 
|  | 
| typedef std::list< std::string > | string_list_t | 
|  | Linked list of strings. 
 | 
|  | 
|  | 
| bool | isAbsolute (const std::string &path) | 
|  | Returns whether path is absolute. 
 | 
|  | 
| std::string | joinPaths (const std::string &first, const std::string &second) | 
|  | Combines two paths into a single one. 
 | 
|  | 
Handles searching a list of paths for a file. 
Access global path searching object. 
This function will create the global path search object if it has not already been created. 
 
 
      
        
          | bool PathSearcher::search | ( | const std::string & | base, | 
        
          |  |  | target_type_t | targetType, | 
        
          |  |  | bool | searchCwd, | 
        
          |  |  | std::string & | result | 
        
          |  | ) |  |  | 
      
 
Attempts to locate a file by using the search paths. 
The base path argument can be either a relative or absolute path. If the path is relative, then it is joined with search paths one after another until a matching file is located or all search paths are exhausted. If the base is absolute, only that path is tested and if invalid false is returned.
- Parameters
- 
  
    |  | base | A path to the file that is to be found. |  |  | targetType | Currently ignored. In the future it will let you select whether to find a file or directory. |  |  | searchCwd | If set to true, the current working directory is searched before using any of the search paths. Otherwise only the search paths are considered. |  | [out] | result | When true is returned this string is set to the first path at which a valid file was found. |  
 
- Return values
- 
  
    | true | A matching file was found among the search paths. The contents of result are a valid path. |  | false | No match could be made. result has been left unmodified. |  
 
 
 
The documentation for this class was generated from the following files: