-
Notifications
You must be signed in to change notification settings - Fork 75
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
Properly compress files which are already partially compressed #54
Comments
I have already thought about a solution for this, here is some pseudocode: Assume ouch compress file.tar.gz file.tar.gz.xz We correctly check if it's compressing only one file, as this check additional check does not make sense when creating archives. Then we can run the function to detect the extensions of both files.
Now we check if the let input_extensions_are_included_in_output_extensions =
input_extensions.len() < output_extensions.len()
&& input_extensions.iter().zip(&output_extensions).all(|(a, b)| a == b); In this case, instead of passing the // Remove the first N elements efficiently
let drain_iter = output_extensions.drain(..input_extensions.len());
drop(drain_iter); // [Tar, Gz, Xz] -> [Xz] Now use the |
Note: this should not care if the filenames are different.
|
There is currently no way to compress an
file.tar
intofile.tar.gz
by only adding the.gz
part,ouch
will detect two extensions,tar
andgz
, repeating the.tar
process for that file that was already in that format.So basically,
ouch compress file.tar.gz file.tar.gz.xz
generates a file of format.tar.gz.tar.gz.xz
, instead of.tar.gz.xz
.The text was updated successfully, but these errors were encountered: