retex-kpath 1.2.0

kpathsea-compatible file lookup for retex
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! A minimal `kpsewhich` clone for debugging: `kpsewhich FORMAT NAME`.
use retex_kpath::{FileFormat, Kpathsea, Options};

fn main() {
    let args: Vec<String> = std::env::args().collect();
    let fmt = match args.get(1).map(String::as_str) {
        Some("lua") => FileFormat::Lua,
        Some("fmt") => FileFormat::Fmt,
        Some("otf") => FileFormat::OpenType,
        Some("tfm") => FileFormat::Tfm,
        _ => FileFormat::Tex,
    };
    let mut k = Kpathsea::new(Options::lualatex()).unwrap();
    let t = std::time::Instant::now();
    let found = k.find_file(&args[2], fmt);
    eprintln!("path: {:?}", k.search_path(fmt));
    println!("{found:?} ({:?})", t.elapsed());
}