From f627a97d24b8908110fe536f13b2c08b7a59efc2 Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Wed, 11 Jan 2023 04:11:04 +0200 Subject: [PATCH] loader: use portable way of path joining --- cli/config/src/lib.rs | 6 ++++-- cli/loader/src/lib.rs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/config/src/lib.rs b/cli/config/src/lib.rs index 0a5eba54..678688fe 100644 --- a/cli/config/src/lib.rs +++ b/cli/config/src/lib.rs @@ -37,7 +37,8 @@ impl Config { let legacy_path = dirs::home_dir() .ok_or(anyhow!("Cannot determine home directory"))? - .join(".tree-sitter/config.json"); + .join(".tree-sitter") + .join("config.json"); if legacy_path.is_file() { return Ok(Some(legacy_path)); } @@ -48,7 +49,8 @@ impl Config { fn xdg_config_file() -> Result { let xdg_path = dirs::config_dir() .ok_or(anyhow!("Cannot determine config directory"))? - .join("tree-sitter/config.json"); + .join("tree-sitter") + .join("config.json"); Ok(xdg_path) } diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index 0f92b051..029da451 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -112,7 +112,8 @@ impl Loader { Ok(path) => PathBuf::from(path), _ => dirs::cache_dir() .ok_or(anyhow!("Cannot determine cache directory"))? - .join("tree-sitter/lib"), + .join("tree-sitter") + .join("lib"), }; Ok(Self::with_parser_lib_path(parser_lib_path)) }