mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
perf(cli): avoid canonicalize_path
if config file does not exist (#15957)
This commit is contained in:
parent
e2f3801221
commit
8d50c09c0d
1 changed files with 14 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue