Skip to content

Commit

Permalink
Get home path from $HOME
Browse files Browse the repository at this point in the history
this _could_ use the home crate (as suggested in rust-lang/libs-team#372)
but theres no reason to attempt to be cross-platform; this depends on so many mac things anyway
  • Loading branch information
amiel committed Aug 22, 2024
1 parent 8355654 commit 7b329bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,14 @@ fn do_update(status: &Status) {
}
}

fn pomo_sock_path() -> Result<String, std::env::VarError> {
let home = std::env::var("HOME")?;

Ok(String::from(home) + "/.pomo/publish.sock")
}

fn main() -> std::io::Result<()> {
let listener = UnixListener::bind("/Users/amiel/.pomo/publish.sock")?;
let listener = UnixListener::bind(pomo_sock_path().expect("Could not get $HOME"))?;

let mut current_status = Status::default();

Expand Down

0 comments on commit 7b329bf

Please sign in to comment.