Crate xdirs

Additional functions for application paths, based on dirs-next.

MIT License Minimum Rust Version crates.io docs.rs Build Audit GitHub stars


This crate extends the set of paths used by an application to store data and configuration. It compliments functions such as cache_dir, config_dir, and data_dir with versions with a suffix _for that take an application name. It is not the case that, for all of such paths, it is safe to append an application name to the generic path, and so these additional functions will ensure the correct construction of the application-specific path.

This is an alternative to the directories-next and maintains a closer interface to dirs-next.

| Generic Form | dirs | Application-Specific Form | | ------------------ | ---- | ------------------------- | | cache_dir | Yes | cache_dir_for | | config_dir | Yes | config_dir_for | | data_dir | Yes | data_dir_for | | data_local_dir | Yes | data_local_dir_for | | favorites_dir | No | favorites_dir_for | | log_dir | No | log_dir_for | | preference_dir | No | preference_dir_for | | template_dir | Yes | template_dir_for |

The column dirs denotes whether the generic form is present in the dirs or dirs-next crate.

Example

```rust use xdirs::{applicationdir, configdirfor, logdir_for};

const APPNAME: &str = env!("CARGOPKG_NAME");

let whereismyappinstalled = applicationdir(); let wheredoireadmyconfig = configdirfor(APPNAME); let wheredoiwritelogfiles = logdirfor(APP_NAME); ```

Additional Functions

The following may be used to determine the location for installed applications.

Finally, for systems that support a notion of an application container or bundle, the following will provide the location to these directories. Currently these only provide values on macOS.

As is the case for dirs-next, this library provides the location of these directories by leveraging the mechanisms defined by


Changes

Version 0.1.1

Version 0.1.0

TODO