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

If the archive has only one directory in the root, then unpack it as OutputDir #70

Open
BorzdeG opened this issue Jul 21, 2024 · 4 comments

Comments

@BorzdeG
Copy link

BorzdeG commented Jul 21, 2024

For example, in Go distributions in the "tar.gz" archive there is only one directory named go and the unpacking gets the path outputDir/go, but I would like only outputDir

@davidnewhall
Copy link
Contributor

Can you tell me more about the problem this solution will solve? Then I'll share and tell you about the problem this solution causes.

@BorzdeG
Copy link
Author

BorzdeG commented Jul 21, 2024

I want to unpack, for example, a Go distribution into the go-1.22.5 directory.

Currently I have to do the following:

  1. Unpack the archive into a temporary directory
  2. Get the first and only go directory from the temporary directory
  3. Move the resulting directory to go-1.22.5
  4. Delete empty temporary directory

What I would really like is some kind of equivalent of --strip-components=1 from tar that I could pass through xtractr.XFile

@davidnewhall
Copy link
Contributor

Doesn't seem like an unreasonable request. I'll look into this. As for the problem this would create that I alluded to, it's probably insignificant in this context, but if you extract two go distribution versions into the same output folder, you'll have a mess.

@BorzdeG
Copy link
Author

BorzdeG commented Jul 21, 2024

  1. unpacking a version of Go - an example of a public archive that was easy to demonstrate
  2. I don’t extract Go into one directory - I’m just writing an analogue of the asdf utility, only in Go :)

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

2 participants