blob: bf206a59c5ed01cf4fa8df4feae890f22efda9d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use crate::*;
#[must_use]
pub fn remove(path: impl AsRef<Path>) -> WriteResult<()> {
let entry = get_entry(&path)?;
let remove_result = match entry.entry_type {
EntryType::File => std::fs::remove_file(&path),
EntryType::Directory => std::fs::remove_dir_all(&path),
};
Ok(io_result_to_write_result(remove_result, path.as_ref())?)
}
#[must_use]
pub fn remove_file(path: impl AsRef<Path>) -> WriteResult<()> {
let remove_result = std::fs::remove_file(&path);
Ok(io_result_to_write_result(remove_result, &path.as_ref())?)
}
|