Handle macOS user paths when running on macOS

This updates the usrdir option to look in /Users/ rather than /home/ when running on macOS, as this is where users' home directories live on this OS.

It also updates the config file's description of the option to hopefully be home directory agnostic.
This commit is contained in:
Jessica Stokes
2021-02-20 17:25:48 -08:00
committed by int 80h
parent d68b815be4
commit 2388cbda98
2 changed files with 6 additions and 2 deletions

View File

@@ -311,7 +311,11 @@ async fn handle_connection(
if url.path().starts_with("/~") && srv.server.usrdir.unwrap_or(false) {
let usr = url.path().trim_start_matches("/~");
let usr: Vec<&str> = usr.splitn(2, "/").collect();
path.push("/home/");
if cfg!(target_os = "macos") {
path.push("/Users/");
} else {
path.push("/home/");
}
if usr.len() == 2 {
path.push(format!("{}/{}/{}", usr[0], "public_gemini", util::url_decode(usr[1].as_bytes())));
} else {