Skip to content

Commit

Permalink
Fix preopened current directory not working
Browse files Browse the repository at this point in the history
This commit fixes the bug where preopening `.` is not reflected in the
virtual filesystem, causing `path_open` to fail to find files.

fixes #4361
  • Loading branch information
yagehu committed Dec 18, 2023
1 parent 1abcd2c commit 866d483
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/cli/src/commands/run/wasi.rs
Expand Up @@ -332,6 +332,11 @@ impl Wasi {
let current_dir =
std::env::current_dir().context("could not determine current directory")?;

mapped_dirs.push(MappedDirectory {
host: current_dir.clone(),
guest: ".".to_string(),
});

MappedDirectory {
host: current_dir,
guest: Self::MAPPED_CURRENT_DIR_DEFAULT_PATH.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion lib/virtual-fs/src/mem_fs/file_opener.rs
Expand Up @@ -187,7 +187,7 @@ impl FileSystem {
let time = time();
Metadata {
ft: FileType {
file: true,
dir: true,
..Default::default()
},
accessed: time,
Expand Down

0 comments on commit 866d483

Please sign in to comment.