| 575 | } |
| 576 | |
| 577 | pub fn get_home() -> PathBuf { |
| 578 | #[cfg(any(target_os = "android", target_os = "ios"))] |
| 579 | return PathBuf::from(APP_HOME_DIR.read().unwrap().as_str()); |
| 580 | #[cfg(not(any(target_os = "android", target_os = "ios")))] |
| 581 | { |
| 582 | if let Some(path) = dirs_next::home_dir() { |
| 583 | patch(path) |
| 584 | } else if let Ok(path) = std::env::current_dir() { |
| 585 | path |
| 586 | } else { |
| 587 | std::env::temp_dir() |
| 588 | } |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | pub fn path<P: AsRef<Path>>(p: P) -> PathBuf { |
| 593 | #[cfg(any(target_os = "android", target_os = "ios"))] |