Configuration directory library
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Reynard User cf600b4d98
Some checks failed
CI / Formatting (push) Has been cancelled
CI / Outdated (push) Has been cancelled
CI / Miri (push) Has been cancelled
CI / Test on macos-latest with Rust 1.87.0 (push) Has been cancelled
CI / Test on macos-latest with Rust beta (push) Has been cancelled
CI / Test on macos-latest with Rust stable (push) Has been cancelled
CI / Test on ubuntu-latest with Rust 1.87.0 (push) Has been cancelled
CI / Test on ubuntu-latest with Rust beta (push) Has been cancelled
CI / Test on ubuntu-latest with Rust stable (push) Has been cancelled
CI / Test on windows-latest with Rust 1.87.0 (push) Has been cancelled
CI / Test on windows-latest with Rust beta (push) Has been cancelled
CI / Test on windows-latest with Rust stable (push) Has been cancelled
chore: sync dependencies (monorepo)
2026-04-13 10:55:44 +02:00
.github/workflows crate: use std::env::home_dir, bump to edition 2024, raise MSRV to 1.87 2025-10-28 13:21:50 +00:00
src Fix URL for XDG Base Directories specification 2025-11-08 16:27:28 +01:00
.gitignore Initialise repository 2020-05-15 20:46:22 +10:00
Cargo.toml chore: sync dependencies (monorepo) 2026-04-13 10:55:44 +02:00
LICENSE-APACHE Spruce up Cargo metadata and relicense under MIT and Apache 2020-05-17 00:26:52 +10:00
LICENSE-MIT Spruce up Cargo metadata and relicense under MIT and Apache 2020-05-17 00:26:52 +10:00
README.md Fix URL for XDG Base Directories specification 2025-11-08 16:27:28 +01:00
rustfmt.toml crate: use std::env::home_dir, bump to edition 2024, raise MSRV to 1.87 2025-10-28 13:21:50 +00:00

crates.io version crates.io revdeps documentation license

Etcetera

This is a Rust library that allows you to determine the locations of configuration, data, cache & other files for your application. Existing Rust libraries generally do not give you a choice in terms of which standards/conventions they follow. Etcetera, on the other hand, gives you the choice.

MSRV: 1.87.0

Note: The MSRV was raised to 1.87.0 in v0.11 to remove the dependency on the home crate & instead use the undeprecated std::env::home_dir. If you want, you can use v0.9 with an MSRV of 1.70.0 or v0.10 with an MSRV of 1.81.0 instead.

Conventions

Etcetera supports the following conventions:

Strategies

Etcetera has 2 modes of operation: BaseStrategy & AppStrategy:

  • With BaseStrategy, you just get the location of the respective directory. For eg. for config_dir():
    • XDG: ~/.config
    • Apple: ~/Library/Preferences
    • Windows: ~\AppData\Roaming
  • With AppStrategy, you provide additional information to get the location of your app directory. For eg. if you provide the following details: { top_level_domain: "org", author: "Acme Corp", app_name: "Frobnicator Plus" }, you'll get:
    • XDG: ~/.config/frobnicator-plus
    • Unix: ~/.frobnicator-plus
    • Apple: ~/Library/Preferences/org.acme-corp.Frobnicator-Plus
    • Windows: ~\AppData\Roaming\Acme Corp\Frobnicator Plus

Note: the location of the home (~) is determined by std::env::home_dir.

Convenience functions

Etcetera also provides convenience functions for selecting the appropriate strategy on each platform:

  • base_strategy::choose_base_strategy & app_strategy::choose_app_strategy: Uses Windows on Windows & XDG everywhere else. This is used by most CLI tools & some GUI tools on each platform.
  • base_strategy::choose_native_strategy & app_strategy::choose_native_strategy: Uses Windows on Windows, Apple on macOS/iOS, & XDG everywhere else. This is used by most GUI applications on each platform.

See the documentation for examples.