simple_fs/common/
system.rs1use crate::{Error, Result, SPath};
2
3pub fn home_dir() -> Result<SPath> {
5 #[allow(deprecated)]
6 let path = std::env::home_dir().ok_or(Error::HomeDirNotFound)?;
7 SPath::from_std_path(path)
8}
9
10#[cfg(test)]
13mod tests {
14 type Result<T> = core::result::Result<T, Box<dyn std::error::Error>>;
15
16 use super::*;
17
18 #[test]
19 fn test_common_system_home_dir_simple() -> Result<()> {
20 let home = home_dir()?;
22
23 assert!(home.exists(), "Home directory should exist");
25 assert!(home.is_absolute(), "Home directory should be an absolute path");
26
27 Ok(())
28 }
29}
30
31