Skip to content

Commit a94ed5b

Browse files
committed
Only download file if not cached
1 parent 84f7d3e commit a94ed5b

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

build.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,22 @@ fn main() {
7070
std::fs::write(&dest, buf).unwrap();
7171

7272
#[cfg(feature = "_test-unicode-conformance")]
73-
std::fs::write(
74-
Path::new(&out).join("emoji-variation-sequences.txt"),
75-
ureq::get("https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-variation-sequences.txt")
76-
.call()
77-
.unwrap()
78-
.body_mut()
79-
.read_to_string()
80-
.unwrap(),
81-
)
82-
.unwrap();
73+
{
74+
let emoji_vs_list = Path::new(&out).join("emoji-variation-sequences.txt");
75+
if !std::fs::read_to_string(&emoji_vs_list)
76+
.is_ok_and(|text| text.contains("Emoji Version 16.0"))
77+
{
78+
let content = ureq::get(
79+
"https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-variation-sequences.txt",
80+
)
81+
.call()
82+
.unwrap()
83+
.body_mut()
84+
.read_to_string()
85+
.unwrap();
86+
std::fs::write(emoji_vs_list, content).unwrap();
87+
}
88+
}
8389
}
8490

8591
/// Processes a single file and turns it into a global module.

0 commit comments

Comments
 (0)