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

◆ resolve_socket_path()

Acquired< std::filesystem::path > MayaFlux::Platform::detail::resolve_socket_path ( const UnixSocketSource & source)
inline

Definition at line 133 of file UnixSocket.hpp.

134 {
135 return std::visit(Overloaded {
137 if (has_control_character(from.path.string())) {
138 return std::unexpected(make_failure(AcquireFailure::Reason::InvalidName, from.path.string()));
139 }
140 return resolve_absolute(from.path);
141 },
142 [](const UnixSocketFromName& from) -> Acquired<std::filesystem::path> {
143 if (auto failure = check_file_name(from.file_name)) {
144 return std::unexpected(*failure);
145 }
146 std::vector<std::filesystem::path> tried;
147 for (const auto& directory : runtime_directory_candidates()) {
148 tried.push_back(directory);
149 if (path_is_directory(directory)) {
150 return directory / from.file_name;
151 }
152 }
153 return std::unexpected(make_failure(AcquireFailure::Reason::Missing, from.file_name, std::move(tried)));
154 } },
155 source);
156 }
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={})
bool has_control_character(std::string_view name)
std::expected< T, AcquireFailure > Acquired
std::vector< std::filesystem::path > runtime_directory_candidates()
Per-user directories a Unix socket may live in, in the order tried.
Source source()
Begin a Source chain.
Definition Plot.hpp:127
A Unix socket at an explicit file path, absolute or relative to the working directory.

References check_file_name(), has_control_character(), MayaFlux::Platform::AcquireFailure::InvalidName, make_failure(), MayaFlux::Platform::AcquireFailure::Missing, path_is_directory(), resolve_absolute(), and MayaFlux::Platform::runtime_directory_candidates().

Referenced by MayaFlux::Platform::acquire_unix_socket(), and MayaFlux::Platform::resolve_unix_socket_path().

Here is the call graph for this function:
Here is the caller graph for this function: