From e86184fcd039091b7c0c6c42074cac4331b8d5af Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sat, 14 Jan 2023 18:46:53 +0400 Subject: [PATCH] FIX codegen, again --- crates/teloxide-core/src/codegen.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/teloxide-core/src/codegen.rs b/crates/teloxide-core/src/codegen.rs index 5e90823e..899343f2 100644 --- a/crates/teloxide-core/src/codegen.rs +++ b/crates/teloxide-core/src/codegen.rs @@ -78,11 +78,13 @@ pub fn ensure_files_contents<'a>( let mut err_count = 0; for (path, contents) in files_and_contents { - let old_contents = fs::read_to_string(path).unwrap(); - - if normalize_newlines(&old_contents) == normalize_newlines(contents) { - // File is already up to date. - continue; + if path.exists() { + let old_contents = fs::read_to_string(path).unwrap(); + + if normalize_newlines(&old_contents) == normalize_newlines(contents) { + // File is already up to date. + continue; + } } err_count += 1;