Trait HomeDirsExt
pub trait HomeDirsExt: Sized
Darwin-specific extensions to fs::HomeDirs.
Required Methods
fn sysdir() -> Result<Self>Load the standard user directory paths for the current user.
On iOS, tvOS, watchOS, visionOS, and sandboxed macOS applications, these directories are within the application's container. Outside the sandbox, these are subdirectories of the
~/Librarydirectory on macOS.The produced directory paths are not guaranteed to be the canonical paths to the directories; they are allowed to be sandbox-redirected paths as long as the directory is accessible there.
The loaded common directories are:
HomeDirsNSSearchPathDirectorycache_homeNSCachesDirectory(~/Library/Caches)config_homeNSApplicationSupportDirectory(~/Library/Application Support)data_homeNSApplicationSupportDirectory(~/Library/Application Support)state_homeNSApplicationSupportDirectory(~/Library/Application Support)Note that the Application Support directory is used for the config, data, and state directories. It is always possible for multiple user directories to be configured to the same path, but this is the common configuration on Apple platforms, making it even more important to not assume files in different user directories cannot alias each other.
Errors
Errors if the user home cannot be determined.
Implementation-specific behavior
Uses the
sysdir(3)API fromlibSystemto discover the standard user directories.This behavior may change in the future. One example change that we explicitly reserve the right to make is to load additional common directories not currently in this list.