diff options
Diffstat (limited to 'crates/utils/cfg_file')
| -rw-r--r-- | crates/utils/cfg_file/src/config.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/utils/cfg_file/src/config.rs b/crates/utils/cfg_file/src/config.rs index 8d97bf0..2333ab7 100644 --- a/crates/utils/cfg_file/src/config.rs +++ b/crates/utils/cfg_file/src/config.rs @@ -193,4 +193,15 @@ pub trait ConfigFile: Serialize + for<'a> Deserialize<'a> + Default { eprintln!("Failed to write file {}: {}", path.display(), e); } } + + /// Check if the file returned by `default_path` exists + fn exist() -> bool + where + Self: Sized + Send + Sync, + { + let Ok(path) = Self::default_path() else { + return false; + }; + path.exists() + } } |
