blob: 846a094be35f09f627987dd797a1923e2d5a3f47 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use crate::EntryWriteError;
use crate::{get_entry, EntryType};
use std::path::Path;
pub fn remove<P>(path: P) -> Result<(), EntryWriteError>
where
P: AsRef<Path>,
{
let entry = get_entry(&path)?;
match entry.entry_type {
EntryType::File => std::fs::remove_file(&path)?,
EntryType::Directory => std::fs::remove_dir_all(&path)?,
}
Ok(())
}
pub fn remove_file<P>(path: P) -> Result<(), EntryWriteError>
where
P: AsRef<Path>,
{
std::fs::remove_file(path)?;
Ok(())
}
|