Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect to child node in a different fs #4689

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/virtual-fs/src/mem_fs/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,11 @@ impl FileSystemInner {
Some(Err(FsError::DirectoryNotEmpty))
}
}

Node::ArcDirectory(ArcDirectoryNode { name, fs, path, .. })
if name.as_os_str() == name_of_directory =>
{
Some(Ok((0, InodeResolution::Redirect(fs.clone(), path.clone()))))
}
_ => None,
})
.ok_or(FsError::InvalidInput)
Expand Down
15 changes: 15 additions & 0 deletions tests/wasi-fyi/fs_remove_dir_all.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::fs;

fn main() {
assert!(fs::create_dir_all("/fyi/foo/bar").is_ok());
maminrayej marked this conversation as resolved.
Show resolved Hide resolved
assert!(fs::create_dir_all("/fyi/foo/baz").is_ok());
assert_eq!(
fs::read_dir("/fyi/foo")
.unwrap()
.map(|e| e.unwrap().file_name())
.collect::<Vec<_>>(),
vec!["bar", "baz"]
);
assert!(fs::remove_dir_all("/fyi/foo").is_ok());
assert!(fs::read_dir("/fyi/foo").is_err());
}
Loading