https://github.com/bbqsrc/windirs
A safe wrapper around `SHGetKnownFolderPath`.
https://github.com/bbqsrc/windirs
folders rust windows
Last synced: 4 months ago
JSON representation
A safe wrapper around `SHGetKnownFolderPath`.
- Host: GitHub
- URL: https://github.com/bbqsrc/windirs
- Owner: bbqsrc
- License: apache-2.0
- Created: 2021-03-06T18:49:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-06T19:54:27.000Z (over 4 years ago)
- Last Synced: 2025-02-01T02:18:00.344Z (4 months ago)
- Topics: folders, rust, windows
- Language: Rust
- Homepage: https://docs.rs/windirs/
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# windirs
[](https://docs.rs/windirs)
A safe wrapper around `SHGetKnownFolderPath`.
## Usage
```rust
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
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.