windirs 1.0.1

A safe wrapper around `SHGetKnownFolderPath`.
Documentation
  • Coverage
  • 2.01%
    3 out of 149 items documented0 out of 3 items with examples
  • Size
  • Source code size: 24.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 481.24 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • bbqsrc/windirs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bbqsrc

windirs

Documentation

A safe wrapper around SHGetKnownFolderPath.

Usage

use windirs::{Error, FolderId, get_known_folder};

let local_app_data_path = match get_known_folder(FolderId::LocalAppData) {
    Ok(path) => path,
    Err(err) => match err {
        // Some folder ids point to virtual paths, so, yeah.
        Error::Virtual => panic!(),
        // When no folder is found.
        Error::NotFound => panic!(),
        // Can occur for a variety of reasons, such as this folder id being unknown to this OS.
        Error::InvalidArg(io_error) => panic!(),
        // Any other potential OS error that could happen, but is not defined by the API.
        Error::Other(io_error) => panic!(),
    }
}

let user_home_path = get_known_folder(FolderId::Profile).unwrap();

License

This project is licensed under either of

at your option.