diff options
Diffstat (limited to 'src/util/fs.rs')
| -rw-r--r-- | src/util/fs.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/fs.rs b/src/util/fs.rs new file mode 100644 index 0000000..b86c0d7 --- /dev/null +++ b/src/util/fs.rs | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #![allow(dead_code)] | ||
| 2 | |||
| 3 | use std::path::Path; | ||
| 4 | |||
| 5 | use crate::errors::McError; | ||
| 6 | |||
| 7 | pub async fn remove_if_exists(path: &Path) -> Result<(), McError> { | ||
| 8 | if path.exists() { | ||
| 9 | tokio::fs::remove_file(path).await?; | ||
| 10 | } | ||
| 11 | Ok(()) | ||
| 12 | } | ||
