[red-knot] Add a read_directory() method to the ruff_db::system::System trait (#12289)

This commit is contained in:
Alex Waygood 2024-07-12 13:31:05 +01:00 committed by GitHub
parent 17e84d5f40
commit 6febd96dfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 239 additions and 4 deletions

View file

@ -303,6 +303,12 @@ impl SystemPath {
self.0.as_std_path()
}
/// Returns the [`Utf8Path`] for the file.
#[inline]
pub fn as_utf8_path(&self) -> &Utf8Path {
&self.0
}
pub fn from_std_path(path: &Path) -> Option<&SystemPath> {
Some(SystemPath::new(Utf8Path::from_path(path)?))
}