diff --git a/crates/librqbit/src/session.rs b/crates/librqbit/src/session.rs index 6f51da9..11916ce 100644 --- a/crates/librqbit/src/session.rs +++ b/crates/librqbit/src/session.rs @@ -324,7 +324,7 @@ impl Session { .output_folder .map(PathBuf::from) .unwrap_or_else(|| self.output_folder.clone()) - .join(sub_folder.as_path()); + .join(sub_folder); let managed_torrent = ManagedTorrent { info_hash, diff --git a/crates/rqbit/src/main.rs b/crates/rqbit/src/main.rs index 55bb930..0e9c33e 100644 --- a/crates/rqbit/src/main.rs +++ b/crates/rqbit/src/main.rs @@ -101,9 +101,17 @@ struct DownloadOpts { torrent_path: Vec, /// The output folder to write to. If not exists, it will be created. + /// If not specified, would use the server's output folder. If there's no server + /// running, this is required. #[clap(short = 'o', long)] output_folder: Option, + /// The sub folder within output folder to write to. Useful when you have + /// a server running with output_folder configured, and don't want to specify + /// the full path every time. + #[clap(short = 's', long)] + sub_folder: Option, + /// If set, only the file whose filename matching this regex will /// be downloaded #[clap(short = 'r', long = "filename-re")] @@ -268,6 +276,7 @@ async fn async_main(opts: Opts, spawner: BlockingSpawner) -> anyhow::Result<()> list_only: download_opts.list, force_tracker_interval: opts.force_tracker_interval.map(|d| d.0), output_folder: download_opts.output_folder.clone(), + sub_folder: download_opts.sub_folder.clone(), ..Default::default() }; let connect_to_existing = match client.validate_rqbit_server().await {