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]
This commit is contained in:
Michael Mauderer 2022-07-04 21:07:52 +02:00 committed by GitHub
parent 4ca2097488
commit 1b0312b446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
}
}