INNER CODE UNIT · Rust
get_socket_path
ilya-zlobintsev/LACT · lact-client/src/lib.rs:266
fn get_socket_path() -> Option<PathBuf> {
let root_path = PathBuf::from("/run/lactd.sock");
if root_path.exists() {
return Some(root_path);
}
let uid = getuid();
let user_path = PathBuf::from(format!("/run/user/{}/lactd.sock", uid));
if user_path.exists() {
Some(user_path)
} else {
None
}
}
#[derive(Debug, Clone, Copy)]