Skip to content
Snippets Groups Projects
Commit efc634a7 authored by arseny.kapoulkine@gmail.com's avatar arseny.kapoulkine@gmail.com
Browse files

archive.pl now creates a wrapping folder in both .tar.gz and .zip archives

git-svn-id: http://pugixml.googlecode.com/svn/trunk@935 99668b35-9821-0410-8761-19e4c4f06640
parent 3af13f1c
No related branches found
No related tags found
No related merge requests found
......@@ -6,21 +6,23 @@ use Archive::Zip;
my $target = shift @ARGV;
my @sources = @ARGV;
my $zip = $target =~ /\.zip$/;
my $basedir = ($target =~ /^(.*)(\.zip|\.tar.gz|\.tgz)$/) ? "$1/" : '';
my $zip = $target =~ /\.zip$/;
my $arch = $zip ? Archive::Zip->new : Archive::Tar->new;
for $source (sort {$a cmp $b} @sources)
{
my $contents = &readfile_contents($source);
my $meta = &readfile_meta($source);
my $file = $basedir . $source;
if ($zip)
{
my $path = $source;
my $path = $file;
$arch->addDirectory($path) if $path =~ s/\/[^\/]+$/\// && !defined($arch->memberNamed($path));
my $member = $arch->addString($contents, $source);
my $member = $arch->addString($contents, $file);
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
$member->desiredCompressionLevel(9);
......@@ -32,7 +34,7 @@ for $source (sort {$a cmp $b} @sources)
# tgz releases are for Unix people, Unix people like Unix newlines
$contents =~ s/\r//g if (-T $source);
$arch->add_data($source, $contents, $meta);
$arch->add_data($file, $contents, $meta);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment