mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
perf(cli): avoid canonicalize_path
if config file does not exist (#15957)
This commit is contained in:
parent
1e8f4a1c40
commit
34d351ac1d
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