gramods
Loading...
Searching...
No Matches
FileResolver.hh
1
2#ifndef GRAMODS_CORE_FILERESOLVER
3#define GRAMODS_CORE_FILERESOLVER
4
5#include <gmCore/config.hh>
6
7#include <filesystem>
8
9BEGIN_NAMESPACE_GMCORE;
10
28
29private:
31 virtual ~FileResolver();
32
33public:
37 enum struct Check {
38 None, //< Perform no check
39 ReadableFile, //< Check if file and readable
40 WritableFile //< Check if file and writable
41 };
42
46 bool readUrnFile(std::filesystem::path urn_file);
47
52 std::filesystem::path resolve(std::string, Check check = Check::None);
53
57 std::filesystem::path resolve(std::filesystem::path path,
58 Check check = Check::None) {
59 return resolve(path.string(), check);
60 }
61
65 static std::filesystem::path getPathToExecutable();
66
71 static FileResolver default_resolver;
72 return &default_resolver;
73 }
74
75private:
76 struct Impl;
77 std::unique_ptr<Impl> _impl;
78};
79
80END_NAMESPACE_GMCORE;
81
82#endif
The FileResolver provides a means to locate resources in a portable manner.
Definition FileResolver.hh:27
static FileResolver * getDefault()
Returns the default resolver.
Definition FileResolver.hh:70
std::filesystem::path resolve(std::filesystem::path path, Check check=Check::None)
Resolves the specified path using the currently loaded rules.
Definition FileResolver.hh:57
Check
Flag for checking path after resolving pattern.
Definition FileResolver.hh:37