mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Create output parent directory if it doesn't exists (#91)
This commit is contained in:
parent
2c3bd78fc1
commit
c37e2495e1
2 changed files with 20 additions and 0 deletions
|
|
@ -647,6 +647,13 @@ fn generate_mkv(
|
|||
|
||||
debug!("ffmpeg {}", command_args.join(" "));
|
||||
|
||||
// create parent directory if it does not exist
|
||||
if let Some(parent) = target.parent() {
|
||||
if !parent.exists() {
|
||||
std::fs::create_dir_all(parent)?
|
||||
}
|
||||
}
|
||||
|
||||
let ffmpeg = Command::new("ffmpeg")
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::piped())
|
||||
|
|
|
|||
|
|
@ -240,6 +240,12 @@ impl Execute for Download {
|
|||
let mut stdout = std::io::stdout().lock();
|
||||
download_segments(&ctx, &mut stdout, None, format.stream).await?;
|
||||
} else {
|
||||
// create parent directory if it does not exist
|
||||
if let Some(parent) = path.parent() {
|
||||
if !parent.exists() {
|
||||
std::fs::create_dir_all(parent)?
|
||||
}
|
||||
}
|
||||
let mut file = File::options().create(true).write(true).open(&path)?;
|
||||
download_segments(&ctx, &mut file, None, format.stream).await?
|
||||
}
|
||||
|
|
@ -259,6 +265,13 @@ async fn download_ffmpeg(
|
|||
let (input_presets, output_presets) =
|
||||
FFmpegPreset::ffmpeg_presets(download.ffmpeg_preset.clone())?;
|
||||
|
||||
// create parent directory if it does not exist
|
||||
if let Some(parent) = target.parent() {
|
||||
if !parent.exists() {
|
||||
std::fs::create_dir_all(parent)?
|
||||
}
|
||||
}
|
||||
|
||||
let mut ffmpeg = Command::new("ffmpeg")
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::null())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue