Skip to content

Commit

Permalink
Allow --output to be a directory
Browse files Browse the repository at this point in the history
fixes: #525
  • Loading branch information
shreyasminocha committed Dec 28, 2024
1 parent 70f06d5 commit 5711935
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/subcommand/torrent/create/create_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,17 @@ impl CreateContent {
.to_owned(),
};

let output = create
let mut output = create
.output
.clone()
.unwrap_or_else(|| OutputTarget::Path(Self::torrent_path(path, &name)));

if let OutputTarget::Path(path) = &output {
if path.is_dir() {
output = OutputTarget::Path(path.join(format!("{name}.torrent")));
}
}

Ok(Self {
files: Some(files),
piece_length,
Expand Down

0 comments on commit 5711935

Please sign in to comment.