Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
prepend ./ to the output path on linux if the input path is only a …
Browse files Browse the repository at this point in the history
…filename (#303)
  • Loading branch information
bytedream committed Jan 8, 2024
1 parent c37d55a commit 1d0ff1d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crunchy-cli-core/src/utils/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crunchyroll_rs::media::{Subtitle, VariantData, VariantSegment};
use crunchyroll_rs::Locale;
use indicatif::{ProgressBar, ProgressDrawTarget, ProgressFinish, ProgressStyle};
use log::{debug, warn, LevelFilter};
use nix::NixPath;
use regex::Regex;
use reqwest::Client;
use std::borrow::Borrow;
Expand Down Expand Up @@ -534,7 +535,14 @@ impl Downloader {
if let Some(output_format) = self.output_format {
command_args.extend(["-f".to_string(), output_format]);
}
command_args.push(dst.to_str().unwrap().to_string());

// prepend './' to the path on linux since ffmpeg may interpret the path incorrectly if it's just the filename.
// see https://github.com/crunchy-labs/crunchy-cli/issues/303 for example
if !cfg!(windows) && dst.parent().map_or(true, |p| p.is_empty()) {
command_args.push(Path::new("./").join(dst).to_string_lossy().to_string());
} else {
command_args.push(dst.to_string_lossy().to_string())
}

debug!("ffmpeg {}", command_args.join(" "));

Expand Down

0 comments on commit 1d0ff1d

Please sign in to comment.