Skip to main content

add_extract_util

Function add_extract_util 

Source
pub fn add_extract_util(lua: &Lua, quiet: bool) -> Result<(), Error>
Expand description

Exposes the UTILS.EXTRACT function to the Lua environment.

This utility provides a unified interface for downloading and extracting various archive formats. It handles:

  • Remote Fetching: If the source starts with http(s), it downloads the file to BUILD_DIR.
  • Format Detection: Dispatches to the appropriate decoder (Zip, Tar, Zstd, Xz, 7z, etc.).
  • Error Propagation: Any failure (network, filesystem, or corruption) is converted into an mlua::Error::RuntimeError, which halts the Lua execution and is caught by the Rust build engine to trigger a rollback.