From 8061894af608cb1f9174995dbf92f1daa1694d2d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 14 Oct 2023 15:00:23 -0400 Subject: [PATCH] Resolve `cache-dir` relative to project root (#7962) ## Summary Unlike other filepath-based settings, the `cache-dir` wasn't being resolved relative to the project root, when specified as an absolute path. Closes https://github.com/astral-sh/ruff/issues/7958. --- crates/ruff_workspace/src/configuration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index 1ef320cd20fe9..8b99965360bef 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -377,7 +377,7 @@ impl Configuration { .cache_dir .map(|dir| { let dir = shellexpand::full(&dir); - dir.map(|dir| PathBuf::from(dir.as_ref())) + dir.map(|dir| fs::normalize_path_to(dir.as_ref(), project_root)) }) .transpose() .map_err(|e| anyhow!("Invalid `cache-dir` value: {e}"))?,