Struct directories::BaseDirs [] [src]

pub struct BaseDirs { /* fields omitted */ }

BaseDirs provides paths of user-invisible standard directories, following the conventions of the operating system the library is running on.

To compute the location of cache, config or data directories for individual projects or applications, use ProjectDirs instead.

Examples

All examples on this page are computed with a user named Alice.

use directories::BaseDirs;
let base_dirs = BaseDirs::new();
base_dirs.config_dir();
// Linux:   /home/alice/.config
// Windows: C:\Users\Alice\AppData\Roaming
// macOS:   /Users/Alice/Library/Preferences

Methods

impl BaseDirs
[src]

[src]

Creates a BaseDirs struct which holds the paths to user-invisible directories for cache, config, etc. data on the system. The returned struct is a snapshot of the state of the system at the time new() was invoked.

impl BaseDirs
[src]

[src]

Returns the path to the user's home directory.

Platform Value Example
Linux $HOME /home/alice
macOS $HOME /Users/Alice
Windows {FOLDERID_Profile} C:\Users\Alice\

[src]

Returns the path to the user's cache directory.

Platform Value Example
Linux $XDG_CACHE_HOME or $HOME/.cache /home/alice/.cache
macOS $HOME/Library/Caches /Users/Alice/Library/Caches
Windows {FOLDERID_LocalAppData}\cache C:\Users\Alice\AppData\Local

[src]

Returns the path to the user's config directory.

Platform Value Example
Linux $XDG_CONFIG_HOME or $HOME/.config /home/alice/.config
macOS $HOME/Library/Preferences /Users/Alice/Library/Preferences
Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming

[src]

Returns the path to the user's data directory.

Platform Value Example
Linux $XDG_DATA_HOME or $HOME/.local/share /home/alice/.local/share
macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming

[src]

Returns the path to the user's local data directory.

Platform Value Example
Linux $XDG_DATA_HOME or $HOME/.local/share /home/alice/.local/share
macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
Windows {FOLDERID_LocalAppData} C:\Users\Alice\AppData\Local

[src]

Returns the path to the user's executable directory.

Platform Value Example
Linux $XDG_BIN_HOME or $XDG_DATA_HOME/../bin or $HOME/.local/bin /home/alice/.local/bin
macOS
Windows

[src]

Returns the path to the user's runtime directory.

Platform Value Example
Linux $XDG_RUNTIME_DIR /run/user/1001/
macOS
Windows

Trait Implementations

impl Debug for BaseDirs
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for BaseDirs
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for BaseDirs

impl Sync for BaseDirs