diff --git a/native/src/base/files.rs b/native/src/base/files.rs index fef451934..a70210ad8 100644 --- a/native/src/base/files.rs +++ b/native/src/base/files.rs @@ -407,7 +407,16 @@ impl Utf8CStr { // We should treat these as application logic and log ASAP, so return LoggedResult. impl Utf8CStr { pub fn remove_all(&self) -> LoggedResult<()> { - let attr = self.get_attr()?; + let attr = match self.get_attr() { + Ok(attr) => attr, + Err(e) => { + return match e.errno { + // Allow calling remove_all on non-existence file + Errno::ENOENT => Ok(()), + _ => Err(e)?, + }; + } + }; if attr.is_dir() { let dir = Directory::open(self)?; dir.remove_all()?; diff --git a/native/src/base/result.rs b/native/src/base/result.rs index e6cae9cb9..6fe853ef2 100644 --- a/native/src/base/result.rs +++ b/native/src/base/result.rs @@ -281,7 +281,7 @@ impl LibcReturn for nix::Result { #[derive(Debug)] pub struct OsError<'a> { - errno: Errno, + pub errno: Errno, name: &'static str, arg1: Option<&'a str>, arg2: Option<&'a str>,