From d64836f3170c443c6fb5f131930223831c6d724c Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 18 Apr 2024 01:49:32 +0200 Subject: [PATCH] Avoid an unneeded syscall --- src/embedded.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/embedded.rs b/src/embedded.rs index 866b12b..eae3099 100644 --- a/src/embedded.rs +++ b/src/embedded.rs @@ -47,14 +47,12 @@ impl EmbeddedFlatDir { let path = Path::new(self.path); if let Err(e) = create_dir(path) { - if !path.is_dir() { + if e.kind() != io::ErrorKind::AlreadyExists { return Err(e); } } - self.readme.write_to_disk(WriteStrategy::Overwrite)?; - - Ok(()) + self.readme.write_to_disk(WriteStrategy::Overwrite) } }