in src/cache.rs [118:147]
fn copy_in_cache(path: Option<PathBuf>, data: &[u8]) -> bool {
if data.is_empty() || data.starts_with(b"Symbol Not Found") {
return false;
}
let path = match path {
Some(p) => p,
_ => return true,
};
if let Some(parent) = path.parent() {
if !parent.exists() {
fs::create_dir_all(parent).unwrap_or_else(|_| {
panic!(
"Unable to create cache directory {}",
parent.to_str().unwrap()
)
});
}
}
let output = File::create(&path)
.unwrap_or_else(|_| panic!("Cannot open file {} for writing", path.to_str().unwrap()));
let mut output = BufWriter::new(output);
output
.write_all(data)
.unwrap_or_else(|_| panic!("Cannot write file {}", path.to_str().unwrap()));
true
}