From 1b0312b446edfa6bcb2737ecbc60522846ab9ac8 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Mon, 4 Jul 2022 21:07:52 +0200 Subject: [PATCH] Avoid patching the file `msdfgen_wasm.js` more than once. (#3560) Adds a fix for a build issue where the `msdfgen_wasm.js` file gets patched multiple times, which breaks the build. [ci no changelog needed] --- lib/rust/ensogl/component/text/msdf-sys/build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rust/ensogl/component/text/msdf-sys/build.rs b/lib/rust/ensogl/component/text/msdf-sys/build.rs index e8cae0abe8f..42314ab42fb 100644 --- a/lib/rust/ensogl/component/text/msdf-sys/build.rs +++ b/lib/rust/ensogl/component/text/msdf-sys/build.rs @@ -43,7 +43,10 @@ mod msdfgen_wasm { let mut open_options = fs::OpenOptions::new(); open_options.append(true); let mut file = open_options.open(path).unwrap(); - file.write_all(PATCH_LINE.as_bytes()).unwrap(); + let file_content = fs::read_to_string(path).unwrap(); + if !file_content.ends_with(PATCH_LINE) { + file.write_all(PATCH_LINE.as_bytes()).unwrap(); + } } }