This commit is contained in:
Mark
2019-03-18 17:46:06 -07:00
parent 2580871f63
commit 874b613f56
2 changed files with 13 additions and 5 deletions

View File

@ -6,8 +6,8 @@ use std::{
path::PathBuf, path::PathBuf,
}; };
use wasmer_runtime_core::cache::{Error as CacheError}; use wasmer_runtime_core::cache::Error as CacheError;
pub use wasmer_runtime_core::cache::{Artifact, Cache, WasmHash, cache_versioned_sub_directory}; pub use wasmer_runtime_core::cache::{cache_versioned_sub_directory, Artifact, Cache, WasmHash};
/// Representation of a directory that contains compiled wasm artifacts. /// Representation of a directory that contains compiled wasm artifacts.
/// ///
@ -54,7 +54,10 @@ impl FileSystemCache {
let metadata = path.metadata()?; let metadata = path.metadata()?;
if metadata.is_dir() { if metadata.is_dir() {
if !metadata.permissions().readonly() { if !metadata.permissions().readonly() {
Ok(Self { path, versioned_sub_directory }) Ok(Self {
path,
versioned_sub_directory,
})
} else { } else {
// This directory is readonly. // This directory is readonly.
Err(io::Error::new( Err(io::Error::new(
@ -75,7 +78,10 @@ impl FileSystemCache {
} else { } else {
// Create the directory and any parent directories if they don't yet exist. // Create the directory and any parent directories if they don't yet exist.
create_dir_all(&path)?; create_dir_all(&path)?;
Ok(Self { path, versioned_sub_directory }) Ok(Self {
path,
versioned_sub_directory,
})
} }
} }
} }

View File

@ -12,7 +12,9 @@ use structopt::StructOpt;
use wasmer::webassembly::InstanceABI; use wasmer::webassembly::InstanceABI;
use wasmer::*; use wasmer::*;
use wasmer_emscripten; use wasmer_emscripten;
use wasmer_runtime::cache::{Cache as BaseCache, FileSystemCache, WasmHash, cache_versioned_sub_directory}; use wasmer_runtime::cache::{
cache_versioned_sub_directory, Cache as BaseCache, FileSystemCache, WasmHash,
};
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
#[structopt(name = "wasmer", about = "Wasm execution runtime.")] #[structopt(name = "wasmer", about = "Wasm execution runtime.")]