Skip to content

Commit

Permalink
fix the output path when the input path is . and the output path is…
Browse files Browse the repository at this point in the history
… not set
  • Loading branch information
magiclen committed Aug 8, 2020
1 parent 64a437b commit 1d5c5f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xcompress"
version = "0.11.3"
version = "0.11.4"
authors = ["Magic Len <[email protected]>"]
edition = "2018"
repository = "https://github.com/magiclen/xcompress"
Expand Down
19 changes: 9 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,15 @@ fn main() -> Result<(), Box<dyn Error>> {

let output_path = sub_matches.value_of("OUTPUT_PATH");

let output_path =
match output_path {
Some(output_path) => Cow::from(Path::new(output_path)),
None => {
Cow::from(CWD.join(format!(
"{}.rar",
input_paths[0].file_name().unwrap().to_string_lossy()
)))
}
};
let output_path = match output_path {
Some(output_path) => Cow::from(Path::new(output_path)),
None => {
Cow::from(CWD.join(format!(
"{}.rar",
input_paths[0].absolutize()?.file_name().unwrap().to_string_lossy()
)))
}
};

let best_compression = sub_matches.is_present("BEST_COMPRESSION");

Expand Down

0 comments on commit 1d5c5f5

Please sign in to comment.