Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
Mark-Simulacrum committed Mar 20, 2020
commit 903f67d599cf12d2d202d5177bb3edecb6cdab00
11 changes: 8 additions & 3 deletions src/tools/unicode-table-generator/src/unicode_download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ static RESOURCES: &[&str] =

pub fn fetch_latest() {
let directory = Path::new(UNICODE_DIRECTORY);
if directory.exists() {
eprintln!(
"Not refetching unicode data, already exists, please delete {:?} to regenerate",
directory
);
return;
}
if let Err(e) = std::fs::create_dir_all(directory) {
if e.kind() != std::io::ErrorKind::AlreadyExists {
panic!("Failed to create {:?}: {}", UNICODE_DIRECTORY, e);
}
panic!("Failed to create {:?}: {}", UNICODE_DIRECTORY, e);
}
let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap();
if !output.status.success() {
Expand Down