diff --git a/src/runtime.rs b/src/runtime.rs index 12c2d72..67feddd 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -88,7 +88,6 @@ impl Runtime { /// Make all mounted files visible to the WASI virtual filesystem fn add_files(&mut self, runner: dynamic::DynamicRunner) -> anyhow::Result<()> { - //TODO(rylev): handle component.exclude_files /// Make a file visible to the WASI virtual filesystem fn add_file( store: &mut wasmtime::Store, @@ -114,8 +113,19 @@ impl Runtime { format!("failed to read glob entry for pattern '{p}'") })?; + // If the file among list of files to be excluded, skip it + if self + .manifest + .component() + .exclude_files + .contains(&host_path.display().to_string()) + { + continue; + } + // Host path is the absolute path to the file let host_path = self.manifest.absolute_from(host_path); + // Only add files if !host_path.is_file() { continue; @@ -139,6 +149,12 @@ impl Runtime { .strip_prefix('/') .unwrap_or(destination.as_str()) ); + + // If the file among list of files to be excluded, skip it + if self.manifest.component().exclude_files.contains(source) { + continue; + } + let host_path = self.manifest.absolute_from(source); // If the host path is a directory, add all files in the directory