#paths #folders #xdg #dirs

pathos

A natural API for handling OS-specific user or system directories, including iOS and Android

22 releases

0.3.0-pre.3 Mar 6, 2021
0.3.0-pre.2 Dec 4, 2020
0.3.0-pre.1 Oct 26, 2020
0.2.0 Oct 24, 2020
0.1.5 May 28, 2020

#89 in Filesystem

Download history 157/week @ 2021-01-15 207/week @ 2021-01-22 304/week @ 2021-01-29 594/week @ 2021-02-05 482/week @ 2021-02-12 352/week @ 2021-02-19 415/week @ 2021-02-26 289/week @ 2021-03-05 258/week @ 2021-03-12 456/week @ 2021-03-19 493/week @ 2021-03-26 490/week @ 2021-04-02 542/week @ 2021-04-09 385/week @ 2021-04-16 383/week @ 2021-04-23 353/week @ 2021-04-30

955 downloads per month
Used in cargo-ndk

Apache-2.0 OR MIT

51KB
1.5K SLoC

pathos

Documentation Actions Status

noun From Ancient Greek πάθος (páthos, “suffering”). The quality or property of anything which touches the feelings or excites emotions and passions, especially that which awakens tender emotions, such as pity, sorrow, and the like; contagious warmth of feeling, action, or expression; pathetic quality.

A natural API for finding OS-specific user or system directories, regardless of the operating system.

pathos specifically supports iOS and Android's idiosyncratic handling of 'user' directories.

Features

URL path handling

pathos supports Unicode-safe URL paths for file:, and a special custom container: scheme on iOS and Android. pathos can convert between ordinary Path types and these Iri types with ease, simplifying saving paths in a configuration system without worrying about OsString problems.

Platform-agnostic modules

Don't care what platform you're building for and just want a project directory in the right place? pathos::system and pathos::user re-export the host platform's submodule.

Platform-specific handling

Sometimes you have to care what platform you're on for special-cased weirdness. In those cases, the appropriate APIs are available on the relevant OS submodule.

Full XDG support

XDG is the default mechanism for handling user directories on Linux, and can be opted into on other platforms by using the pathos::xdg module.

Usage

Add the following to your Cargo.toml:

pathos = "0.2"

Where is this used?

  • box - a modern replacement for the zip file format
  • pahkat - a cross-platform package management system

License

Licensed under either of

at your option.

Dependencies

~0.7–1.3MB
~30K SLoC