xdg-user

Crates.ioxdg-user
lib.rsxdg-user
version0.2.1
sourcesrc
created_at2020-05-03 19:52:24.863798
updated_at2020-05-14 08:25:23.605683
descriptionA library for accessing common user file directories according to `xdg-user-dirs`
homepagehttps://github.com/rijenkii/xdg-user-rs
repositoryhttps://github.com/rijenkii/xdg-user-rs
max_upload_size
id237210
size31,727
Rijenkii (rijenkii)

documentation

https://docs.rs/xdg-user

README

crates.io docs.rs

xdg-user

This simple crate allows you to get paths to well known user directories, using xdg-user-dirss 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());

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 20

cargo fmt