chore(macos): allow tauri to build on macOS (#9391)

When working on UI stuff for the Tauri clients on macOS it's helpful if
the UI is buildable. This is a first stab at getting a stub client to
launch on macOS with the help of our AI overlords. Feel free to close or
heavily critique if there is a better approach.
This commit is contained in:
Jamil
2025-06-06 02:15:39 -07:00
committed by GitHub
parent 192e7e040e
commit 822832e02b
2 changed files with 41 additions and 8 deletions

View File

@@ -1,25 +1,59 @@
use crate::BUNDLE_ID;
use std::path::PathBuf;
/// Returns the user's home directory
fn home_dir() -> Option<PathBuf> {
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<PathBuf> {
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<PathBuf> {
unimplemented!()
Some(PathBuf::from("/Library/Logs").join(BUNDLE_ID))
}
/// User-specific logs directory
pub fn logs() -> Option<PathBuf> {
unimplemented!()
Some(
home_dir()?
.join("Library/Caches")
.join(BUNDLE_ID)
.join("logs"),
)
}
/// Runtime directory for temporary files
pub fn runtime() -> Option<PathBuf> {
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<PathBuf> {
unimplemented!()
Some(
home_dir()?
.join("Library/Application Support")
.join(BUNDLE_ID)
.join("data"),
)
}
/// User settings/config directory
pub fn settings() -> Option<PathBuf> {
unimplemented!()
Some(
home_dir()?
.join("Library/Preferences")
.join(BUNDLE_ID)
.join("config"),
)
}

View File

@@ -47,8 +47,7 @@ pub fn get() -> Option<Duration> {
#[cfg(target_os = "macos")]
pub fn get() -> Option<Duration> {
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
}