archiveFormatFromPath function
Infers the archive format from a filesystem path's extension (omp's
archiveFormatFromPath).
Implementation
ArchiveFormat? archiveFormatFromPath(String filePath) {
final normalized = filePath.toLowerCase();
if (normalized.endsWith('.tar.gz') || normalized.endsWith('.tgz')) {
return ArchiveFormat.tarGz;
}
if (normalized.endsWith('.tar')) return ArchiveFormat.tar;
if (normalized.endsWith('.zip')) return ArchiveFormat.zip;
return null;
}