1 unstable release
Uses new Rust 2024
new 0.1.0 | May 16, 2025 |
---|
#993 in Filesystem
11KB
134 lines
Library to create dot directories in common system places.
It's essentially a wrapper around the dirs
crate that allows you to create dot directories
(e.g. /home/user/.project-name) in common places (e.g. Home dir, Config dir etc.) to store program data and configs.
You can also create them in custom locations
Examples
use dotstore;
fn main() -> std::io::Result<()> {
// Create a new directory called `/home/user/.barracuda`
// The `.` is automatically appended
let project_dir = dotstore::home_store("barracuda")?;
// Create a new directory called `/home/user/.config/.editor`
let editor_dir = dotstore::config_store("editor")?;
// Create a new directory called `/home/user/workspace/middle-earth/.eregion`
let custom_dir = dotstore::custom_store("/home/user/workspace/middle-earth", "eregion")?;
Ok(())
}
Dotstore
Create dot directories (e.g. /home/user/.path
) in common system directories.
Install
cargo add dotstore
Usage
use dotstore;
fn main() -> std::io::Result<()> {
// Create a new directory called `/home/user/.barracuda`
// The `.` is automatically appended
let project_dir = dotstore::home_store("barracuda")?;
// Create a new directory called `/home/user/.config/.editor`
let editor_dir = dotstore::config_store("editor")?;
// Create a new directory called `/home/user/workspace/middle-earth/.eregion`
let custom_dir = dotstore::custom_store("/home/user/workspace/middle-earth", "eregion")?;
Ok(())
}
Dependencies
~0.3–7MB
~50K SLoC