Skip to content
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

Closed
jnthn opened this issue Jan 10, 2017 · 4 comments
Closed

[Feature Request] Extract to a particular directory #4

jnthn opened this issue Jan 10, 2017 · 4 comments

Comments

@jnthn
Copy link
Contributor

jnthn commented Jan 10, 2017

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 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).

@frithnanth
Copy link
Owner

frithnanth commented Jan 11, 2017 via email

@b2gills
Copy link

b2gills commented Jan 11, 2017

Perl 5's File::Spec is handled by calling methods on $*SPEC ( IO::Spec::* )

@frithnanth
Copy link
Owner

frithnanth commented Jan 11, 2017 via email

@jnthn
Copy link
Contributor Author

jnthn commented Jan 12, 2017

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants