[−][src]Crate xdg_user
This simple crate allows you to get paths to well known user directories,
using xdg-user-dirs
s user-dirs.dirs
file.
There are two ways of using this crate - with functions in the root of the
crate, or with the UserDirs
struct. UserDirs
will read and parse the
config file only once - when you call the UserDirs::new
function.
Functions in the root will read and parse the config file EVERY TIME you
call them - so use them ONLY if you need to get one or two folders one or
two times.
Example
println!("Pictures folder: {:?}", xdg_user::pictures()?); println!("Music folder: {:?}", xdg_user::music()?); let dirs = xdg_user::UserDirs::new()?; println!("Documents folder: {:?}", dirs.documents()); println!("Downloads folder: {:?}", dirs.downloads());
Structs
UserDirs | This crates main and only struct, allows you to access the paths to all the user directories |
Enums
Error | This crates main and only error type |
Functions
desktop | Returns an absolute path to users desktop directory ( |
documents | Returns an absolute path to users documents directory ( |
downloads | Returns an absolute path to users downloads directory ( |
music | Returns an absolute path to users music directory ( |
pictures | Returns an absolute path to users pictures directory ( |
public | Returns an absolute path to users public share directory
( |
templates | Returns an absolute path to users templates directory ( |
videos | Returns an absolute path to users videos directory ( |