mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
Create the checkout dir if necessary
This commit is contained in:
@@ -144,6 +144,9 @@ impl DownloadCached for WasmerHome {
|
|||||||
return Ok(cached);
|
return Ok(cached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::fs::create_dir_all(&checkouts)
|
||||||
|
.with_context(|| format!("Unable to make sure \"{}\" exists", checkouts.display()))?;
|
||||||
|
|
||||||
// Note: we want to copy directly into a file so we don't hold
|
// Note: we want to copy directly into a file so we don't hold
|
||||||
// everything in memory.
|
// everything in memory.
|
||||||
let (mut f, path) = if self.disable_cache {
|
let (mut f, path) = if self.disable_cache {
|
||||||
@@ -162,9 +165,10 @@ impl DownloadCached for WasmerHome {
|
|||||||
(f, cached_path)
|
(f, cached_path)
|
||||||
};
|
};
|
||||||
|
|
||||||
std::io::copy(&mut response, &mut f)
|
let bytes_read = std::io::copy(&mut response, &mut f)
|
||||||
.and_then(|_| f.flush())
|
.and_then(|bytes_read| f.flush().map(|_| bytes_read))
|
||||||
.with_context(|| format!("Unable to save the response to \"{}\"", path.display()))?;
|
.with_context(|| format!("Unable to save the response to \"{}\"", path.display()))?;
|
||||||
|
tracing::debug!(bytes_read, path=%path.display(), "Saved to disk");
|
||||||
|
|
||||||
if !self.disable_cache {
|
if !self.disable_cache {
|
||||||
if let Some(etag) = etag {
|
if let Some(etag) = etag {
|
||||||
|
|||||||
Reference in New Issue
Block a user