Skip to main content

Module platform

Module platform 

Source
Expand description

Authoritative platform detection for the renderer.

Frontend code used to lean on navigator.userAgent, which lies on Linux WebViews that masquerade as Mac/Safari for compatibility. Rust knows the host OS for certain via std::env::consts::OS, so this module exposes it as a Tauri command and the renderer caches the result through its usePlatform() hook.

Functions§

get_platform
Return the host platform string as known to Rust: "macos", "linux", "windows", etc. — the value of std::env::consts::OS. The renderer normalises this through normalisePlatform in lib/platform.ts.