1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::{io::Result, path::Path};
use crate::runtime::syscall;
mod open;
pub use open::OpenOptions;
mod file;
pub use file::File;
mod metadata;
pub use metadata::Metadata;
pub async fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<()> {
let from = from.as_ref();
let to = to.as_ref();
syscall::rename(from, to).await
}
pub async fn remove_file<P: AsRef<Path>>(path: P) -> Result<()> {
let path = path.as_ref();
syscall::unlink(path).await
}
pub async fn create_dir<P: AsRef<Path>>(path: P) -> Result<()> {
let path = path.as_ref();
syscall::mkdir(path, 0o777).await
}
pub async fn remove_dir<P: AsRef<Path>>(path: P) -> Result<()> {
let path = path.as_ref();
syscall::rmdir(path).await
}