Skip to main content

extract_tar_gz_if_new

Function extract_tar_gz_if_new 

Source
pub fn extract_tar_gz_if_new(
    rt: &mut RustRuntimeServices<'_>,
    persistent_dir: Option<&Path>,
    file: &Path,
    file_version: &str,
) -> Result<PathBuf>
Expand description

Extracts the given .tar.gz file into persistent_dir (or into std::env::current_dir(), if no persistent dir is available).

Unlike .tar.bz2, .tar.gz is handled natively by every platform’s tar, so this helper has no install-package dependency to track. The caller resolves the persistent dir itself and passes it (already read) as persistent_dir — no Deps struct needed.

To avoid redundant extracts between pipeline runs, callers must provide a file_version string that identifies the current file. If the previous run already extracted an archive with the given file_version, this function will return nearly instantaneously.