Skip to content

Commit bc2246c

Browse files
committed
- respects component exclude files
Signed-off-by: Aminu 'Seun Joshua <[email protected]> - fmt Signed-off-by: Aminu 'Seun Joshua <[email protected]> - cleaner code Signed-off-by: Aminu 'Seun Joshua <[email protected]>
1 parent 593860b commit bc2246c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/runtime.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ impl Runtime {
8888

8989
/// Make all mounted files visible to the WASI virtual filesystem
9090
fn add_files(&mut self, runner: dynamic::DynamicRunner) -> anyhow::Result<()> {
91-
//TODO(rylev): handle component.exclude_files
9291
/// Make a file visible to the WASI virtual filesystem
9392
fn add_file<T>(
9493
store: &mut wasmtime::Store<T>,
@@ -116,6 +115,15 @@ impl Runtime {
116115

117116
// Host path is the absolute path to the file
118117
let host_path = self.manifest.absolute_from(host_path);
118+
// If the file among list of files to be excluded, skip it
119+
if self
120+
.manifest
121+
.component()
122+
.exclude_files
123+
.contains(&host_path.display().to_string())
124+
{
125+
continue;
126+
}
119127
// Only add files
120128
if !host_path.is_file() {
121129
continue;
@@ -140,6 +148,15 @@ impl Runtime {
140148
.unwrap_or(destination.as_str())
141149
);
142150
let host_path = self.manifest.absolute_from(source);
151+
// If the file among list of files to be excluded, skip it
152+
if self
153+
.manifest
154+
.component()
155+
.exclude_files
156+
.contains(&host_path.display().to_string())
157+
{
158+
continue;
159+
}
143160

144161
// If the host path is a directory, add all files in the directory
145162
if host_path.is_dir() {

0 commit comments

Comments
 (0)