diff --git a/rust/bin-shared/src/known_dirs/macos.rs b/rust/bin-shared/src/known_dirs/macos.rs index 3b71831bc..7b9d9b7f3 100644 --- a/rust/bin-shared/src/known_dirs/macos.rs +++ b/rust/bin-shared/src/known_dirs/macos.rs @@ -1,25 +1,59 @@ +use crate::BUNDLE_ID; use std::path::PathBuf; +/// Returns the user's home directory +fn home_dir() -> Option { + std::env::var_os("HOME").map(PathBuf::from) +} + +/// Path for Tunnel service config that the Tunnel service can write +#[expect(clippy::unnecessary_wraps)] // Signature must match Windows pub fn tunnel_service_config() -> Option { - unimplemented!() + Some( + PathBuf::from("/Library/Application Support") + .join(BUNDLE_ID) + .join("config"), + ) } +/// Path for Tunnel service logs +#[expect(clippy::unnecessary_wraps)] // Signature must match Windows pub fn tunnel_service_logs() -> Option { - unimplemented!() + Some(PathBuf::from("/Library/Logs").join(BUNDLE_ID)) } +/// User-specific logs directory pub fn logs() -> Option { - unimplemented!() + Some( + home_dir()? + .join("Library/Caches") + .join(BUNDLE_ID) + .join("logs"), + ) } +/// Runtime directory for temporary files pub fn runtime() -> Option { - unimplemented!() + let user = std::env::var("USER").ok()?; + Some(PathBuf::from("/tmp").join(format!("{}-{}", BUNDLE_ID, user))) } +/// User session data directory pub fn session() -> Option { - unimplemented!() + Some( + home_dir()? + .join("Library/Application Support") + .join(BUNDLE_ID) + .join("data"), + ) } +/// User settings/config directory pub fn settings() -> Option { - unimplemented!() + Some( + home_dir()? + .join("Library/Preferences") + .join(BUNDLE_ID) + .join("config"), + ) } diff --git a/rust/bin-shared/src/uptime/mod.rs b/rust/bin-shared/src/uptime/mod.rs index 455fa2cd7..1bdc7e568 100644 --- a/rust/bin-shared/src/uptime/mod.rs +++ b/rust/bin-shared/src/uptime/mod.rs @@ -47,8 +47,7 @@ pub fn get() -> Option { #[cfg(target_os = "macos")] pub fn get() -> Option { - debug_assert!(false, "Not implemented on macOS"); - + // TODO: This is stubbed on macOS for now so that mac developers can help out on the Tauri UI. None }