| 590 | } |
| 591 | |
| 592 | pub fn path<P: AsRef<Path>>(p: P) -> PathBuf { |
| 593 | #[cfg(any(target_os = "android", target_os = "ios"))] |
| 594 | { |
| 595 | let mut path: PathBuf = APP_DIR.read().unwrap().clone().into(); |
| 596 | path.push(p); |
| 597 | return path; |
| 598 | } |
| 599 | #[cfg(not(any(target_os = "android", target_os = "ios")))] |
| 600 | { |
| 601 | #[cfg(not(target_os = "macos"))] |
| 602 | let org = "".to_owned(); |
| 603 | #[cfg(target_os = "macos")] |
| 604 | let org = ORG.read().unwrap().clone(); |
| 605 | // /var/root for root |
| 606 | if let Some(project) = |
| 607 | directories_next::ProjectDirs::from("", &org, &APP_NAME.read().unwrap()) |
| 608 | { |
| 609 | let mut path = patch(project.config_dir().to_path_buf()); |
| 610 | path.push(p); |
| 611 | return path; |
| 612 | } |
| 613 | "".into() |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | #[allow(unreachable_code)] |
| 618 | pub fn log_path() -> PathBuf { |