summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/args/config_file.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs
index 0b9c51b7c..b0a5b355b 100644
--- a/cli/args/config_file.rs
+++ b/cli/args/config_file.rs
@@ -525,6 +525,20 @@ impl ConfigFile {
std::env::current_dir()?.join(path_ref)
};
+ // perf: Check if the config file exists before canonicalizing path.
+ if !config_file.exists() {
+ return Err(
+ std::io::Error::new(
+ std::io::ErrorKind::InvalidInput,
+ format!(
+ "Could not find the config file: {}",
+ config_file.to_string_lossy()
+ ),
+ )
+ .into(),
+ );
+ }
+
let config_path = canonicalize_path(&config_file).map_err(|_| {
std::io::Error::new(
std::io::ErrorKind::InvalidInput,