Subject: | _extract_file() creates extraneous directory for single file extraction |
The extract_file() method of Archive::Tar allows for the selective extraction of an archive member (file or directory), with the option to specify an alternate full path name (including filename) for the member.
However, as currently coded, in the case of an individual file if an alternate path is specified the filename itself is created as a directory with the file itself (properly named) then under that directory.
e.g. extract_file('foo/bar', 'my/file') where 'bar' is a file will create the contents of 'bar' as 'my/file/file' instead of as 'my/file'.
This is easily remedied with a one-line patch:
--- Archive-Tar-1.23.orig/lib/Archive/Tar.pm Fri Dec 3 09:37:45 2004
+++ Archive-Tar-1.23/lib/Archive/Tar.pm Wed Feb 2 12:06:40 2005
@@ -471,7 +471,7 @@
my $dir;
### is $name an absolute path? ###
if( File::Spec->file_name_is_absolute( $name ) ) {
- $dir = $name;
+ $dir = $dirs;
### it's a relative path ###
} else {