standard_paths 2.1.0

A port of QStandardPaths class which provides methods for accessing standard paths on the local filesystem (config, cache, user directories and etc.).
Documentation
use standard_paths::*;

fn main() {
    let locations = vec![
        ("Home", LocationType::HomeLocation),
        ("Desktop", LocationType::DesktopLocation),
        ("Documents", LocationType::DocumentsLocation),
        ("Download", LocationType::DownloadLocation),
        ("Movies", LocationType::MoviesLocation),
        ("Music", LocationType::MusicLocation),
        ("Pictures", LocationType::PicturesLocation),
        ("Applications", LocationType::ApplicationsLocation),
        ("Fonts", LocationType::FontsLocation),
        ("Runtime", LocationType::RuntimeLocation),
        ("Temp", LocationType::TempLocation),
        ("Generic Data", LocationType::GenericDataLocation),
        ("App Data", LocationType::AppDataLocation),
        ("App Local Data", LocationType::AppLocalDataLocation),
        ("Generic Cache", LocationType::GenericCacheLocation),
        ("App Cache", LocationType::AppCacheLocation),
        ("Config", LocationType::ConfigLocation),
        ("Generic Config", LocationType::GenericConfigLocation),
        ("App Config", LocationType::AppConfigLocation),
    ];

    let sl = StandardPaths::new("app", "org");

    println!("\nListing standard locations:");
    for (name, value) in &locations {
        match sl.standard_locations(*value) {
            Ok(paths) => println!(
                "{:>14}: \"{}\"",
                name,
                paths
                    .iter()
                    .map(|p| p.to_str().unwrap())
                    .collect::<Vec<_>>()
                    .join("\", \"")
            ),
            Err(err) => println!("{name:>14}: {err}"),
        }
    }

    println!("\nListing writable locations:");
    for (name, value) in &locations {
        match sl.writable_location(*value) {
            Ok(path) => println!(r#"{name:>14}: "{}""#, path.to_str().unwrap()),
            Err(err) => println!("{name:>14}: {err}"),
        }
    }
}