fix: legacy folder asset (#3264)
This commit is contained in:
1 parent
a7806583b2
commit
2c1215c6a4
1 file changed
+14
-13
@@ -38,20 +38,21 @@ pub(crate) fn process_file_to(
|
|||||||
Some("jpg" | "jpeg" | "png" | "webp" | "avif") => {
|
Some("jpg" | "jpeg" | "png" | "webp" | "avif") => {
|
||||||
process_image(&ImageAssetOptions::new(), source, output_path)?;
|
process_image(&ImageAssetOptions::new(), source, output_path)?;
|
||||||
}
|
}
|
||||||
None if source.is_dir() => {
|
|
||||||
process_folder(source, output_path)?;
|
|
||||||
}
|
|
||||||
Some(_) | None => {
|
Some(_) | None => {
|
||||||
let source_file = std::fs::File::open(source)?;
|
if source.is_dir() {
|
||||||
let mut reader = std::io::BufReader::new(source_file);
|
process_folder(source, output_path)?;
|
||||||
let output_file = std::fs::File::create(output_path)?;
|
} else {
|
||||||
let mut writer = std::io::BufWriter::new(output_file);
|
let source_file = std::fs::File::open(source)?;
|
||||||
std::io::copy(&mut reader, &mut writer).with_context(|| {
|
let mut reader = std::io::BufReader::new(source_file);
|
||||||
format!(
|
let output_file = std::fs::File::create(output_path)?;
|
||||||
"Failed to write file to output location: {}",
|
let mut writer = std::io::BufWriter::new(output_file);
|
||||||
output_path.display()
|
std::io::copy(&mut reader, &mut writer).with_context(|| {
|
||||||
)
|
format!(
|
||||||
})?;
|
"Failed to write file to output location: {}",
|
||||||
|
output_path.display()
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AssetOptions::Css(options) => {
|
AssetOptions::Css(options) => {
|
||||||
|
|||||||
Reference in new issue
Block a user