mirror of
https://github.com/typst/typst
synced 2025-08-19 09:28:33 +08:00
feat(cli): also create output directory if it doesn't already exist
This commit is contained in:
parent
a41f821fa6
commit
c4f5ba84d1
@ -137,6 +137,14 @@ impl CompileConfig {
|
|||||||
panic!("input path must be non-empty, as guarded by the CLI");
|
panic!("input path must be non-empty, as guarded by the CLI");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// create directory if doesn't exist yet
|
||||||
|
std::fs::create_dir_all(&path).map_err(|err| {
|
||||||
|
eco_format!(
|
||||||
|
"failed to create output directory at {path}: {err}",
|
||||||
|
path = path.display()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
|
||||||
path.push(file_name);
|
path.push(file_name);
|
||||||
path.set_extension(match output_format {
|
path.set_extension(match output_format {
|
||||||
OutputFormat::Pdf => "pdf",
|
OutputFormat::Pdf => "pdf",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user