Finds a file in the working directory or system paths. More...
#include <Path.hpp>
Public Types | |
| using | path = std::filesystem::path |
convenience alias for std::filesystem::path | |
Public Member Functions | |
| Path (path subdir={}) | |
Constructs a Path object with subdir appended to all search paths. | |
| std::vector< path > | paths () |
Returns the list of system paths to search, including the subdir suffix. | |
| path | find (path target, std::vector< path > extra_dirs={{"."}}) |
finds the file target | |
Finds a file in the working directory or system paths.
The "system paths" are:
//local/usrusr/local$HOME$HOME/.local | hexed::Path::Path | ( | path | subdir = {} | ) |
Constructs a Path object with subdir appended to all search paths.
E.g., if the file your looking for is a shared library, you probably want to do subdir = "lib".
| Path::path hexed::Path::find | ( | path | target, |
| std::vector< path > | extra_dirs = {{"."}} ) |
finds the file target
If target is a relative path, it will be searched for in the following directories are searched, in order of precedence:
extra_dirs, which defaults to the current working directoryHEXEDPATH, which should be a colon-separated list, if it is setIf target is not found, the return value is an empty path. If target is an absolute path, it will be returned if it exists and the empty path will be returned otherwise.