Migrate prepare_modules to Rust

This commit is contained in:
topjohnwu
2025-08-02 13:53:35 -07:00
committed by John Wu
parent 959430e030
commit 7961be5cfa
7 changed files with 63 additions and 42 deletions

View File

@@ -309,7 +309,7 @@ impl Directory {
self.pre_order_walk_impl(&mut f)
}
pub fn remove_all(&mut self) -> OsResultStatic<()> {
pub fn remove_all(mut self) -> OsResultStatic<()> {
self.post_order_walk(|e| {
e.unlink()?;
Ok(WalkResult::Continue)

View File

@@ -227,7 +227,7 @@ impl Utf8CStr {
pub fn remove_all(&self) -> OsResultStatic<()> {
let attr = self.get_attr()?;
if attr.is_dir() {
let mut dir = Directory::try_from(open_fd(self, O_RDONLY | O_CLOEXEC, 0)?)?;
let dir = Directory::try_from(open_fd(self, O_RDONLY | O_CLOEXEC, 0)?)?;
dir.remove_all()?;
}
Ok(self.remove()?)