oliver 0.1.9

Lightweight CLI mod manager for Baldur's Gate 3 on Linux
Documentation
use crate::Settings;
use anyhow::{bail, Result};
use larian_formats::{format::Write, lspk};
use std::path::PathBuf;

impl Settings {
    pub(crate) fn pack_helper(mod_files_root: PathBuf, destination: Option<PathBuf>) -> Result<()> {
        let writer = lspk::Writer::with_mod_root_path(mod_files_root)?;

        let destination = destination.or_else(|| {
            writer.mod_file_name().map(|p| {
                let mut path = PathBuf::from(p);
                path.set_extension("pak");
                path
            })
        });

        let Some(destination) = destination else {
            bail!(
                "No destination file name specified, and no meta.lsx found in `Mods/` subdirectory"
            );
        };

        writer.write(destination)?;
        Ok(())
    }
}