Skip to content

Commit e660953

Browse files
committed
Only run create_dir_all once
1 parent 255e03f commit e660953

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/generator.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ pub(crate) fn generate(
6464
minijinja_env.add_template(tpl_path, &tpl_source)?;
6565
let tpl = minijinja_env.get_template(tpl_path)?;
6666

67+
fs::create_dir_all(output_dir)?;
68+
6769
let postprocessor = Postprocessor::from_ext(tpl_file_ext, output_dir);
6870

6971
let generator = Generator {
@@ -174,9 +176,6 @@ impl Generator<'_> {
174176

175177
let file_path = self.output_dir.join(format!("{basename}.{tpl_file_ext}"));
176178

177-
if !self.output_dir.exists() {
178-
fs::create_dir_all(self.output_dir)?;
179-
}
180179
let out_file = BufWriter::new(File::create(&file_path)?);
181180

182181
self.tpl.render_to_write(ctx, out_file)?;

0 commit comments

Comments
 (0)