dir: add set times
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::error::Error;
|
||||
use crate::file::{FdFlags, FileCaps, FileType, Filestat, OFlags, WasiFile};
|
||||
use cap_fs_ext::SystemTimeSpec;
|
||||
use std::any::Any;
|
||||
use std::convert::TryInto;
|
||||
use std::ops::Deref;
|
||||
@@ -35,6 +36,12 @@ pub trait WasiDir {
|
||||
target_dir: &dyn WasiDir,
|
||||
target_path: &str,
|
||||
) -> Result<(), Error>;
|
||||
fn set_times(
|
||||
&self,
|
||||
path: &str,
|
||||
atime: Option<SystemTimeSpec>,
|
||||
mtime: Option<SystemTimeSpec>,
|
||||
) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
pub(crate) struct DirEntry {
|
||||
@@ -399,4 +406,13 @@ impl WasiDir for cap_std::fs::Dir {
|
||||
self.hard_link(Path::new(src_path), target_dir, Path::new(target_path))?;
|
||||
Ok(())
|
||||
}
|
||||
fn set_times(
|
||||
&self,
|
||||
path: &str,
|
||||
atime: Option<SystemTimeSpec>,
|
||||
mtime: Option<SystemTimeSpec>,
|
||||
) -> Result<(), Error> {
|
||||
cap_fs_ext::DirExt::set_times(self, Path::new(path), atime, mtime)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user