dirs-lite
A minimal, dependency-free crate for getting the user's config, data, and cache directories.
Usage
use ;
Platform Behavior
config_dir()
| Platform | Path |
|---|---|
| Linux | $XDG_CONFIG_HOME or $HOME/.config |
| macOS | $HOME/Library/Application Support |
| Windows | %APPDATA% |
data_dir()
| Platform | Path |
|---|---|
| Linux | $XDG_DATA_HOME or $HOME/.local/share |
| macOS | $HOME/Library/Application Support |
| Windows | %LOCALAPPDATA% |
cache_dir()
| Platform | Path |
|---|---|
| Linux | $XDG_CACHE_HOME or $HOME/.cache |
| macOS | $HOME/Library/Caches |
| Windows | %LOCALAPPDATA% |
Features
favor-xdg-style- On macOS, returns XDG-style paths ($HOME/.config,$HOME/.local/share,$HOME/.cache) instead of Apple paths.
Platform Conventions
- XDG Base Directory Specification (Linux)
- Apple File System Programming Guide (macOS)
- Known Folder IDs (Windows)
Alternatives
Need more? Consider these crates:
dirs- More directory types (cache, data, etc.)directories- Project-specific paths with organization supportetcetera- Strategy-based (XDG, Apple, Windows)
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.