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

Skip compressing file if its the same file as the output #193

Merged
merged 2 commits into from
Nov 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use fs_err canonicalize
sigmaSd committed Nov 14, 2021
commit 3e52eb6deb62a5cc171eba10d1ad8e001d8df593
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ pub fn run(args: Opts, question_policy: QuestionPolicy) -> crate::Result<()> {
Subcommand::Compress { mut files, output: output_path } => {
// If the output_path file exists and is the same as some of the input files, warn the user and skip those inputs (in order to avoid compression recursion)
if output_path.exists() {
clean_input_files_if_needed(&mut files, &output_path.canonicalize()?);
clean_input_files_if_needed(&mut files, &fs::canonicalize(&output_path)?);
}
// After cleaning, if there are no input files left, exit
if files.is_empty() {