mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 22:04:44 +00:00
Misc. dependency cleanup (#6810)
* remove ensure_dir_exists (2 deps saved) * group UNHANDLED_ERRORs into a generic (2 deps saved) * Introduce separate `health_metrics` crate * separate health_metrics crate * remove metrics from warp_utils * move ProcessHealth::observe and SystemHealth::observe to health_metrics * fix errors * nitpick `Cargo.toml`s --------- Co-authored-by: Daniel Knopik <daniel@dknopik.de> # Conflicts: # Cargo.toml
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use clap::ArgMatches;
|
||||
pub use eth2_network_config::DEFAULT_HARDCODED_NETWORK;
|
||||
use std::fs::{self, create_dir_all};
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// Names for the default directories.
|
||||
@@ -30,17 +30,6 @@ pub fn get_network_dir(matches: &ArgMatches) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if a directory exists in the given path and creates a directory if it does not exist.
|
||||
pub fn ensure_dir_exists<P: AsRef<Path>>(path: P) -> Result<(), String> {
|
||||
let path = path.as_ref();
|
||||
|
||||
if !path.exists() {
|
||||
create_dir_all(path).map_err(|e| format!("Unable to create {:?}: {:?}", path, e))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// If `arg` is in `matches`, parses the value as a path.
|
||||
///
|
||||
/// Otherwise, attempts to find the default directory for the `testnet` from the `matches`.
|
||||
|
||||
Reference in New Issue
Block a user