usdpl_back/api_common/
dirs.rs1use std::path::PathBuf;
4
5pub fn home() -> Option<PathBuf> {
7 #[cfg(not(any(feature = "decky", feature = "crankshaft")))]
8 let result = crate::api_any::dirs::home();
9 #[cfg(all(feature = "decky", not(any(feature = "crankshaft"))))]
10 let result = crate::api_decky::home()
11 .ok()
12 .map(|x| PathBuf::from(x).join("..").canonicalize().ok())
13 .flatten();
14
15 result
16}
17
18pub fn plugin() -> Option<PathBuf> {
20 #[cfg(not(any(feature = "decky", feature = "crankshaft")))]
21 let result = None; #[cfg(all(feature = "decky", not(any(feature = "crankshaft"))))]
23 let result = crate::api_decky::plugin_dir().ok().map(|x| x.into());
24
25 result
26}
27
28pub fn log() -> Option<PathBuf> {
30 #[cfg(not(any(feature = "decky", feature = "crankshaft")))]
31 let result = crate::api_any::dirs::log();
32 #[cfg(all(feature = "decky", not(any(feature = "crankshaft"))))]
33 let result = crate::api_decky::log_dir().ok().map(|x| x.into());
34
35 result
36}