Improved unzip overwriting mechanism
Change-Id: I93007d3d622bd14b32b1631922e93a53d315ab23
diff --git a/Changes b/Changes
index cce79da..2bc208c 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.28 2017-04-11
+ - Improved overwriting behaviour for unzip.
+
0.27 2017-04-10
- Support configuration files.
- Support temporary extraction.
diff --git a/lib/KorAP/XML/Archive.pm b/lib/KorAP/XML/Archive.pm
index 5dd6855..58a8731 100644
--- a/lib/KorAP/XML/Archive.pm
+++ b/lib/KorAP/XML/Archive.pm
@@ -146,7 +146,7 @@
my @init_cmd = (
'unzip', # Use unzip program
'-qo', # quietly overwrite all existing files
- '-o',
+ '-u',
'-d', $target_dir # Extract into target directory
);
@@ -172,6 +172,7 @@
# Only single call
if (!$jobs || $jobs == 1) {
foreach (@cmds) {
+
system(@$_);
# Check for return code
@@ -198,8 +199,9 @@
foreach my $cmd (@cmds) {
my $pid = $pool->start and next ARCHIVE_LOOP;
system(@$cmd);
+ my $code = $?;
my $last = $cmd->[4];
- $pool->finish($?, \"$last");
+ $pool->finish($code, \"$last");
};
$pool->wait_all_children;
};
@@ -220,7 +222,7 @@
my @init_cmd = (
'unzip', # Use unzip program
'-qo', # quietly overwrite all existing files
- '-o',
+ '-u',
'-d', $target_dir # Extract into target directory
);
@@ -278,7 +280,7 @@
my @init_cmd = (
'unzip', # Use unzip program
'-qo', # quietly overwrite all existing files
- '-o',
+ '-u',
'-d', $target_dir # Extract into target directory
);
diff --git a/lib/KorAP/XML/Krill.pm b/lib/KorAP/XML/Krill.pm
index 8e5ae8f..e94baaa 100644
--- a/lib/KorAP/XML/Krill.pm
+++ b/lib/KorAP/XML/Krill.pm
@@ -16,7 +16,7 @@
use Data::Dumper;
use File::Spec::Functions qw/catdir catfile catpath splitdir splitpath rel2abs/;
-our $VERSION = '0.27';
+our $VERSION = '0.28';
has 'path';
has [qw/text_sigle doc_sigle corpus_sigle/];