Skip to content

Commit 903f67d

Browse files
Avoid re-fetching Unicode data
If the unicode-downloads folder already exists, we likely just fetched the data, so don't make any further network requests. Unicode versions are released rarely enough that this doesn't matter much in practice.
1 parent f4c675c commit 903f67d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/tools/unicode-table-generator/src/unicode_download.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ static RESOURCES: &[&str] =
1111

1212
pub fn fetch_latest() {
1313
let directory = Path::new(UNICODE_DIRECTORY);
14+
if directory.exists() {
15+
eprintln!(
16+
"Not refetching unicode data, already exists, please delete {:?} to regenerate",
17+
directory
18+
);
19+
return;
20+
}
1421
if let Err(e) = std::fs::create_dir_all(directory) {
15-
if e.kind() != std::io::ErrorKind::AlreadyExists {
16-
panic!("Failed to create {:?}: {}", UNICODE_DIRECTORY, e);
17-
}
22+
panic!("Failed to create {:?}: {}", UNICODE_DIRECTORY, e);
1823
}
1924
let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap();
2025
if !output.status.success() {

0 commit comments

Comments
 (0)