diff options
author | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-03-15 19:35:54 +0700 |
---|---|---|
committer | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-03-15 19:35:54 +0700 |
commit | b7f0a8a2b2961c04f022e8177c34dfb9d6ac7cc6 (patch) | |
tree | 5e7ecdd38c44cd48061b8fcbeb14e1b670af1390 /src/utilities.rs | |
parent | ef420db3ab72b1a49a7706fdbabce1a179b41bf9 (diff) |
path helpers
Diffstat (limited to 'src/utilities.rs')
-rw-r--r-- | src/utilities.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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<String, HashMap<String, Option<String>>>; @@ -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); + } +} |