#xdg #xdg-base #directory #applications #user-friendly #specification

config-better

Configure your application in a friendlier and more consistent way!

4 releases (stable)

1.2.0 Nov 16, 2023
1.1.0 Aug 12, 2023
1.0.0 Aug 12, 2023
0.1.0 Sep 20, 2021

#479 in Filesystem

Download history 38/week @ 2024-01-04 55/week @ 2024-01-11 21/week @ 2024-01-18 86/week @ 2024-01-25 15/week @ 2024-02-01 26/week @ 2024-02-08 53/week @ 2024-02-15 42/week @ 2024-02-22 38/week @ 2024-02-29 72/week @ 2024-03-07 42/week @ 2024-03-14 39/week @ 2024-03-21 44/week @ 2024-03-28 160/week @ 2024-04-04 62/week @ 2024-04-11 377/week @ 2024-04-18

644 downloads per month
Used in 2 crates (via uggo-config)

MIT license

19KB
380 lines

config-better-rs

Make use of directories for configuration / data / caching better and more user-friendly!

This module provides support for the XDG Base Directory specification, and OS-friendly fallbacks for Windows, Mac OS, and Linux if not otherwise specified.

This is a port of the Python version of the same name.

Usage

use config_better::Config;

fn main() {
    let dirs = Config::new("some-app");
    println!("{:?}", dirs);

    // View paths
    println!("{:?}", dirs.cache);
    println!("{:?}", dirs.config);
    println!("{:?}", dirs.data);

    // Create/delete a single directory
    dirs.cache.create();
    dirs.cache.remove();

    // Create/delete all directories
    dirs.create_all();
    dirs.remove_all();
}

Any directory create and remove methods can have an async counterpart provided by the async feature.

For further details, refer to installation instructions on crates.io and docs on docs.rs.

MSRV

For the sync and async features of the crate, the MSRV is 1.61.0. For the async-tokio feature of the crate, the MSRV is 1.63.0.

Dependencies

~0.3–14MB
~141K SLoC