From b7f0a8a2b2961c04f022e8177c34dfb9d6ac7cc6 Mon Sep 17 00:00:00 2001 From: Rosyid Haryadi Date: Sat, 15 Mar 2025 19:35:54 +0700 Subject: path helpers --- src/utilities.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/utilities.rs') diff --git a/src/utilities.rs b/src/utilities.rs index aa7a44e..1c2b26f 100644 --- a/src/utilities.rs +++ b/src/utilities.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::path::PathBuf; pub type ConfigHashMap = HashMap>>; @@ -28,3 +29,15 @@ macro_rules! create_path_or_die { } }; } + +pub fn path_should_exist(path: &PathBuf, message: &str) { + if !path.exists() { + die!(message); + } +} + +pub fn path_should_not_exist(path: &PathBuf, message: &str) { + if path.exists() { + die!(message); + } +} -- cgit v1.2.3-70-g09d2