Skip to main content

defaults

Function defaults 

Source
pub fn defaults(
    platform: Platform,
    mac_version: (u32, u32, u32),
) -> Vec<(&'static str, Value)>
Expand description

Every preference with its default on platform, in music21’s order.

mac_version is the running macOS’s version, which says where Preview is; music21 reads it as (0, 0, 0) off a Mac. The paths come as music21 stores them, cleaned as clean_path cleans them.

use music21::environment::{self, Platform, Value};

let defaults = environment::defaults(Platform::Darwin, (14, 0, 0));
let preview = defaults.iter().find(|(key, _)| *key == "pdfPath");
assert_eq!(
    preview.map(|(_, value)| value),
    Some(&Value::text("/System/Applications/Preview.app"))
);
assert_eq!(defaults.len(), 21);