| 
    gramods
    
   | 
 
The FileResolver provides a means to locate resources in a portable manner. More...
#include <FileResolver.hh>
Classes | |
| struct | Impl | 
Public Types | |
| enum class | Check { None , ReadableFile , WritableFile } | 
| Flag for checking path after resolving pattern.  More... | |
Public Member Functions | |
| bool | readUrnFile (std::filesystem::path urn_file) | 
| Reads in mappings from the specified URN file.  More... | |
| std::filesystem::path | resolve (std::string, Check check=Check::None) | 
| Resolves the specified string as a path using the currently loaded rules.  More... | |
| std::filesystem::path | resolve (std::filesystem::path path, Check check=Check::None) | 
| Resolves the specified path using the currently loaded rules.  More... | |
Static Public Member Functions | |
| static std::filesystem::path | getPathToExecutable () | 
| Returns the path to the running executable.  More... | |
| static FileResolver * | getDefault () | 
| Returns the default resolver.  More... | |
The FileResolver provides a means to locate resources in a portable manner.
The default behavior (FileResolver::getDefault()) is to first check if there is an environment variable GM_URN_FILE pointing at a file. If not it checks if there is an environment variable GM_HOME that points at a folder with a file "gramods.urn". If not it checks if there is a file gramods.urn in the same folder as the executable currently running.
The URN file is parsed for mappings in the form urn:key: path/. If the path is absolute, then the occurance of "urn:key:" is replaced with this path and if it is relative, the key is replaced with a path relative the location of the URN file. 
      
  | 
  strong | 
Flag for checking path after resolving pattern.
      
  | 
  inlinestatic | 
Returns the default resolver.
      
  | 
  static | 
Returns the path to the running executable.
| bool gramods::gmCore::FileResolver::readUrnFile | ( | std::filesystem::path | urn_file | ) | 
Reads in mappings from the specified URN file.
      
  | 
  inline | 
Resolves the specified path using the currently loaded rules.
| std::filesystem::path gramods::gmCore::FileResolver::resolve | ( | std::string | str_path, | 
| Check | check = Check::None  | 
        ||
| ) | 
Resolves the specified string as a path using the currently loaded rules.