https://github.com/artichoke/known-folders-rs
🪟 📁 Rust bindings to the Known Folders API on Windows
https://github.com/artichoke/known-folders-rs
artichoke knownfolders rust rust-crate windows
Last synced: about 2 months ago
JSON representation
🪟 📁 Rust bindings to the Known Folders API on Windows
- Host: GitHub
- URL: https://github.com/artichoke/known-folders-rs
- Owner: artichoke
- License: apache-2.0
- Created: 2023-05-17T22:42:07.000Z (about 2 years ago)
- Default Branch: trunk
- Last Pushed: 2025-04-01T00:01:25.000Z (2 months ago)
- Last Synced: 2025-04-01T01:21:43.453Z (about 2 months ago)
- Topics: artichoke, knownfolders, rust, rust-crate, windows
- Language: Rust
- Homepage: https://crates.io/crates/known-folders
- Size: 1.73 MB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# known-folders-rs
[](https://github.com/artichoke/known-folders-rs/actions)
[](https://discord.gg/QCe2tp2)
[](https://twitter.com/artichokeruby)
[](https://crates.io/crates/known-folders)
[](https://docs.rs/known-folders)
[](https://artichoke.github.io/known-folders-rs/known_folders/)Retrieves the full path of a known folder identified by the folder's
**KNOWNFOLDERID** on Windows systems using `SHGetKnownFolderPath` and the [Known
Folders] API.[known folders]:
https://learn.microsoft.com/en-us/windows/win32/shell/known-foldersThe Known Folders API first appeared in Windows Vista.
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
known-folders = "1.2.0"
```Then resolve well-known directories like this:
```rust
use known_folders::{get_known_folder_path, KnownFolder};let profile_dir = get_known_folder_path(KnownFolder::Profile);
```You can test this crate works on your platform by running the example:
```shell
cargo run --example get_profile_dir
```## Implementation
known-folders-rs binds directly to `Win32` using [`windows_sys`].
Semver-incompatible `windows_sys` upgrades can be made in minor releases.[`windows_sys`]: https://crates.io/crates/windows-sys
Note that this crate is completely empty on non-Windows platforms.
## Minimum Supported Rust Version
This crate requires at least Rust 1.60.0. This version can be bumped in minor
releases.## License
`known-folders-rs` is distributed under the terms of either the
[MIT License](LICENSE-MIT) or the
[Apache License (Version 2.0)](LICENSE-APACHE).