Skip to main content

dir_in

Function dir_in 

Source
pub fn dir_in(home: &Path, profile: &str) -> Result<PathBuf, Error>
Expand description

Ported from Dir, with the home directory taken as an explicit parameter rather than read from $HOME/os.UserHomeDir() internally (see PORT_NOTES.md’s “Design notes” section). There is no zero-argument wrapper in this crate; production callers (e.g. xianyun_cli::commands::up) resolve $HOME themselves and pass it in, keeping the ambient-environment read at the CLI’s edge rather than buried in a library function.

Creates the directory if it doesn’t exist. The path is <home>/ .local/share/xianyun/<profile>/, unless that doesn’t exist yet AND <home>/.local/share/caproni/<profile>/ (the pre-rename path) does, in which case the existing caproni-path profile directory is used instead of creating a fresh, empty one and orphaning the existing state.