MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ acquire_header_root()

Acquired< std::filesystem::path > MayaFlux::Platform::acquire_header_root ( const std::filesystem::path & directory,
std::string_view marker_file = {} )
inlinenodiscard

Validate a header root: an existing directory, optionally containing a marker file.

Parameters
directoryThe directory the JIT will add to its include search path. Relative paths resolve against the working directory.
marker_fileA plain file name that must be a regular file inside directory, or empty for none.
Returns
The absolute directory, or the reason it was refused.

Definition at line 303 of file Acquisition.hpp.

305 {})
306{
307 auto absolute = detail::resolve_absolute(directory);
308 if (!absolute) {
309 return std::unexpected(absolute.error());
310 }
311 if (!detail::path_exists(*absolute)) {
312 return std::unexpected(detail::make_failure(AcquireFailure::Reason::Missing, directory.string(), { *absolute }));
313 }
314 if (!detail::path_is_directory(*absolute)) {
315 return std::unexpected(detail::make_failure(AcquireFailure::Reason::NotDirectory, directory.string(), { *absolute }));
316 }
317 if (!marker_file.empty()) {
318 if (auto failure = detail::check_file_name(marker_file)) {
319 return std::unexpected(*failure);
320 }
321 const std::filesystem::path marker = *absolute / marker_file;
322 if (!detail::path_is_regular_file(marker)) {
323 return std::unexpected(detail::make_failure(AcquireFailure::Reason::MarkerMissing, directory.string(), { marker }));
324 }
325 }
326 return *absolute;
327}
bool path_is_regular_file(const std::filesystem::path &path)
bool path_exists(const std::filesystem::path &path)
bool path_is_directory(const std::filesystem::path &path)
std::optional< AcquireFailure > check_file_name(std::string_view name)
std::expected< std::filesystem::path, AcquireFailure > resolve_absolute(const std::filesystem::path &path)
AcquireFailure make_failure(AcquireFailure::Reason reason, std::string request, std::vector< std::filesystem::path > tried={})

Referenced by MayaFlux::Host::add_header(), and MayaFlux::Host::add_include_root().

Here is the caller graph for this function: