If available, use ripunzip also for extracting specific files
Change-Id: I27eb84bc0a26621018320c19cb41ae79a8ad1da2
diff --git a/lib/KorAP/XML/Archive.pm b/lib/KorAP/XML/Archive.pm
index 7e46f79..8f2834f 100644
--- a/lib/KorAP/XML/Archive.pm
+++ b/lib/KorAP/XML/Archive.pm
@@ -291,10 +291,15 @@
my $first = 1;
- my @init_cmd = (
- 'unzip', # Use unzip program
- '-qo', # quietly overwrite all existing files
- '-uo',
+ # Ensure ripunzip availability is checked
+ test_ripunzip();
+
+ my @init_cmd = ($RIPUNZIP_AVAILABLE ?
+ # Use ripunzip program
+ ('ripunzip', 'unzip-file', '-q')
+ :
+ # Use InfoZIP unzip program
+ ('unzip', '-qo', '-uo')
);
my @cmds;
diff --git a/t/archive.t b/t/archive.t
index adf7559..0fda9b4 100644
--- a/t/archive.t
+++ b/t/archive.t
@@ -54,7 +54,7 @@
ok($archive->extract_sigle(0, ['TEST/BSP/8'], $dir), 'Wrong path');
}
);
- like($stdout, qr!Extract unzip!);
+ like($stdout, qr!Extract (ripunzip|unzip)!);
};
ok(-d catdir($dir, 'TEST'), 'Test corpus directory exists');
@@ -73,7 +73,7 @@
my @cmd = map { join ' ', @{$_} } $archive->cmds_from_sigle(['REI/RB*', 'REI/BNG/00071']);
-like($cmd[0], qr!unzip -qo -uo t/corpus/archive_rei\.zip!);
+like($cmd[0], qr!(ripunzip unzip-file -q|unzip -qo -uo) t/corpus/archive_rei\.zip!);
like($cmd[0], qr!\QREI/header.xml REI/RB*/header.xml REI/RB* REI/BNG/header.xml REI/BNG/00071/*\E!);
ok(!$cmd[1]);