From c48e0f4b5f42817458ef02b523178a5ab3c2b8b1 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Sun, 4 Jun 2023 07:49:30 +0200 Subject: [PATCH] don't try to create target directory when it already exists --- src/docbuilder/rustwide_builder.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/docbuilder/rustwide_builder.rs b/src/docbuilder/rustwide_builder.rs index 1e77631a8..be47198ac 100644 --- a/src/docbuilder/rustwide_builder.rs +++ b/src/docbuilder/rustwide_builder.rs @@ -761,7 +761,12 @@ impl RustwideBuilder { let old_dir = target_dir.join("doc"); let new_dir = target_dir.join(target).join("doc"); debug!("rename {} to {}", old_dir.display(), new_dir.display()); - std::fs::create_dir(target_dir.join(target))?; + { + let parent = new_dir.parent().unwrap(); + if !parent.exists() { + std::fs::create_dir(target_dir.join(target))?; + } + } std::fs::rename(old_dir, new_dir)?; }