Skip to main content

add_archive_util

Function add_archive_util 

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

Exposes the UTILS.ARCHIVE table and UTILS.MAKE_ARCHIVE function to the Lua environment.

UTILS.ARCHIVE includes:

  • list(path): Lists the contents of an archive.

UTILS.MAKE_ARCHIVE(source, output, algorithm): Creates an archive from a source path.

§Errors

Returns an mlua::Error if:

  • The UTILS table cannot be found.
  • Filesystem operations (open, create, metadata, read, write) fail.
  • Archive processing (zip, tar, etc.) fails.
  • Unsupported archive format or algorithm is provided.

§Panics

This function may panic if:

  • Stripping path prefixes fails during ZIP creation.
  • The parent of a source path cannot be determined.