mirror of https://github.com/astral-sh/ruff
[ty] use SystemPath::absolute instead of dunce::canonicalize
This commit is contained in:
parent
118cbfc282
commit
f1aeeaa40c
|
|
@ -30,7 +30,6 @@ clearscreen = { workspace = true }
|
||||||
colored = { workspace = true }
|
colored = { workspace = true }
|
||||||
crossbeam = { workspace = true }
|
crossbeam = { workspace = true }
|
||||||
ctrlc = { version = "3.4.4" }
|
ctrlc = { version = "3.4.4" }
|
||||||
dunce = { workspace = true }
|
|
||||||
indicatif = { workspace = true }
|
indicatif = { workspace = true }
|
||||||
jiff = { workspace = true }
|
jiff = { workspace = true }
|
||||||
rayon = { workspace = true }
|
rayon = { workspace = true }
|
||||||
|
|
|
||||||
|
|
@ -186,23 +186,16 @@ impl CheckCommand {
|
||||||
self.paths
|
self.paths
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|path| {
|
.filter_map(|path| {
|
||||||
let path = path.as_std_path();
|
if !path.as_std_path().is_dir() {
|
||||||
if !path.is_dir() {
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Ok(canonical_path) = dunce::canonicalize(path) else {
|
let path = SystemPath::absolute(path, project_root);
|
||||||
return None;
|
let path = path.strip_prefix(project_root).ok()?;
|
||||||
};
|
let path = path.to_string().replace('\\', "/");
|
||||||
|
let path = path.strip_suffix('/').unwrap_or(&path);
|
||||||
|
|
||||||
let relative_path = canonical_path
|
Some(RelativeGlobPattern::cli(format!("{path}/**/*")))
|
||||||
.strip_prefix(project_root.as_std_path())
|
|
||||||
.ok()?;
|
|
||||||
let path_str = relative_path.to_str()?;
|
|
||||||
let path_str = path_str.replace('\\', "/");
|
|
||||||
let normalized_path = path_str.strip_suffix('/').unwrap_or(&path_str);
|
|
||||||
|
|
||||||
Some(RelativeGlobPattern::cli(format!("{normalized_path}/**/*")))
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue