Merge pull request #1224 from CyberShadow/pull-20210701-205820

fix(cli): Avoid ENOENT if config.json is not in TREE_SITTER_DIR
This commit is contained in:
Max Brunsfeld 2021-07-01 14:51:22 -07:00 committed by GitHub
commit ad30779d90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,9 @@ impl Config {
if let Ok(path) = env::var("TREE_SITTER_DIR") {
let mut path = PathBuf::from(path);
path.push("config.json");
return Ok(Some(path));
if path.is_file() {
return Ok(Some(path));
}
}
let xdg_path = Self::xdg_config_file()?;