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

◆ list_unix_sockets()

std::vector< std::filesystem::path > MayaFlux::Platform::list_unix_sockets ( )
inlinenodiscard

The Unix sockets that sit in the user's runtime directories, sorted by path.

Every directory of runtime_directory_candidates() that can be read is listed, once each however many candidates name it, and the entries that is_unix_socket() accepts are returned. Directories that are missing or unreadable are skipped. Nothing is probed: a socket nothing answers on is listed too.

Definition at line 181 of file UnixSocket.hpp.

182{
183 std::vector<std::filesystem::path> sockets;
184
185 for (const auto& directory : runtime_directory_candidates()) {
186 std::error_code ec;
187 std::filesystem::directory_iterator entry(directory, ec);
188 const std::filesystem::directory_iterator end;
189
190 while (!ec && entry != end) {
191 if (is_unix_socket(entry->path())) {
192 sockets.push_back(entry->path());
193 }
194 entry.increment(ec);
195 }
196 }
197
198 std::ranges::sort(sockets);
199 const auto duplicates = std::ranges::unique(sockets);
200 sockets.erase(duplicates.begin(), duplicates.end());
201 return sockets;
202}
std::vector< std::filesystem::path > runtime_directory_candidates()
Per-user directories a Unix socket may live in, in the order tried.
bool is_unix_socket(const std::filesystem::path &path)
Whether a path holds a Unix socket file, without following a symbolic link.

References is_unix_socket(), and runtime_directory_candidates().

Here is the call graph for this function: