toonconv 0.1.0

A Rust CLI tool for converting JSON to TOON (Token-Oriented Object Notation) format
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::path::{Path, PathBuf};

/// Map an input JSON file into an output TOON file path.
/// This preserves the input directory structure relative to `input_dir`.
pub fn map_input_to_output(
    input_dir: &Path,
    input_file: &Path,
    output_dir: &Path,
    extension: &str,
) -> PathBuf {
    let relative = input_file.strip_prefix(input_dir).unwrap_or(input_file);
    let mut out = output_dir.join(relative);
    out.set_extension(extension);
    out
}