-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Extract to a particular directory #4
Comments
Now the .extract method has a new optional argument $destpath.
Since I've found no Perl6 analogous of File::Spec, I simply chained the
path this way:
$e.pathname: $destpath ~ '/' ~ $e.pathname
which, I admit, is quite horrible.
Take it as a quick patch.
…On Tue, Jan 10, 2017 at 6:12 PM, Jonathan Worthington < ***@***.***> wrote:
One thing I miss is being able to tell extract where exactly to extract
things to. I was trying to use the library to replace an invocation like:
run "tar", "xfz", $archive, "-C", $local-temp;
Which extracts the files into $local-temp. Having done a little digging,
it seems that libarchive doesn't doesn't actually support this very
directly, but the answer here
<http://stackoverflow.com/questions/8384266/libarchive-extract-to-specified-directory>
mentions a way to do it.
While I might get away with chdir it's going to be fragile/tricky. My
application works concurrently (so multiple threads) but chdir is
process-global. Perl 6 tries to avoid this problem by "simulating" chdir
using $*CWD but that won't help a NativeCall'd library. We can really
change the directory at OS level using &PROCESS::chdir which should
change it from the perspective of libarchive. Unfortunately, given I have
a concurrent application, then the moment I get two things going on in my
application that need to &PROCESS::chdir, I'm going to have a very a bad
time. :-) So I'd rather not introduce that.
Please let me know if this feature request seems reasonable. If you can
implement it, even better...failing that I may find time for a patch (I'm
also hoping to contribute something for making it easy to install this
library on Windows, by fetching the DLL automatically like GTK::Simple
does).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#4>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADyA2P6y57-wpaosPDi5elfCnYdg7THSks5rQ7v_gaJpZM4LfqgA>
.
--
Fernando Santagata
|
Perl 5's File::Spec is handled by calling methods on |
Thank you!
…On Wed, Jan 11, 2017 at 8:55 PM, Brad Gilbert ***@***.***> wrote:
Perl 5's File::Spec is handled by calling methods on $*SPEC ( IO::Spec::*
)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADyA2Pdbm_-uSIda37DwYETrH1zr68i6ks5rRTOngaJpZM4LfqgA>
.
--
Fernando Santagata
|
Just tried it out, and it works great. Thanks very much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One thing I miss is being able to tell
extract
where exactly to extract things to. I was trying to use the library to replace an invocation like:Which extracts the files into
$local-temp
. Having done a little digging, it seems thatlibarchive
doesn't doesn't actually support this very directly, but the answer here mentions a way to do it.While I might get away with
chdir
it's going to be fragile/tricky. My application works concurrently (so multiple threads) butchdir
is process-global. Perl 6 tries to avoid this problem by "simulating"chdir
using$*CWD
but that won't help a NativeCall'd library. We can really change the directory at OS level using&PROCESS::chdir
which should change it from the perspective oflibarchive
. Unfortunately, given I have a concurrent application, then the moment I get two things going on in my application that need to&PROCESS::chdir
, I'm going to have a very a bad time. :-) So I'd rather not introduce that.Please let me know if this feature request seems reasonable. If you can implement it, even better...failing that I may find time for a patch (I'm also hoping to contribute something for making it easy to install this library on Windows, by fetching the DLL automatically like GTK::Simple does).
The text was updated successfully, but these errors were encountered: