Skip to main content

unifier/daemon/
paths.rs

1//! Unix socket paths and daemon identity files.
2
3use std::path::PathBuf;
4
5use crate::home::UnifierHome;
6
7const DAEMON_DIR: &str = ".daemon";
8
9pub fn daemon_dir(home: &UnifierHome) -> PathBuf {
10    home.path().join(DAEMON_DIR)
11}
12
13pub fn socket_path(home: &UnifierHome) -> PathBuf {
14    daemon_dir(home).join("unifier.sock")
15}
16
17/// Outbound notices for mailbox/event wakeup (Jan cron listens here).
18pub fn events_socket_path(home: &UnifierHome) -> PathBuf {
19    daemon_dir(home).join("events.sock")
20}
21
22pub fn pid_path(home: &UnifierHome) -> PathBuf {
23    daemon_dir(home).join("unifier.pid")
24}
25
26/// Temp static files served by the daemon HTTP listener.
27pub fn www_dir(home: &UnifierHome) -> PathBuf {
28    daemon_dir(home).join("www")
29}
30
31/// Bound localhost HTTP port (written when the web server starts).
32pub fn http_port_path(home: &UnifierHome) -> PathBuf {
33    daemon_dir(home).join("http.port")
34}