Skip to main content

install

Function install 

Source
pub fn install(
    package: PackageRef,
    ruleset: InstallRuleset<'_>,
    source: impl AsRef<Path>,
    profile: impl AsRef<Path>,
    no_links: bool,
    checksum: Option<Checksum>,
) -> Result<(InstalledPackage, Vec<Utf8PathBuf>)>
Expand description

Install a package’s files into a game profile directory.

Walks source recursively, maps each file through the given ruleset, and copies (or hard-links) the mapped files into profile. Returns the InstalledPackage descriptor and a list of file paths that were overwritten.

§Examples

use camino::Utf8Path;
use loadsmith_core::{PackageRef, Version, PackageId};
use loadsmith_install::{install, InstallRuleset, InstallRule, GlobRule};

let pkg = PackageRef::new(PackageId::new("denikson-BepInExPack_Valheim"), Version::new(5, 4, 22));
let rule = InstallRule::Glob(
    GlobRule::try_from_pattern("**", Utf8Path::new("BepInEx")).unwrap()
);
let rules = [rule];
let ruleset = InstallRuleset::new(&rules);
let (installed, overwritten) = install(
    pkg,
    ruleset,
    "C:\\extracted\\package",
    "C:\\games\\Valheim\\profile",
    false,
    None,
).unwrap();