Fix file watching on macOS if a module-search path is a symlink (#12634)

This commit is contained in:
Micha Reiser 2024-08-03 09:24:07 +02:00 committed by GitHub
parent 38e178e914
commit 341a25eec1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 158 additions and 91 deletions

View file

@ -43,6 +43,16 @@ pub trait System: Debug {
/// This function will traverse symbolic links to query information about the destination file.
fn path_metadata(&self, path: &SystemPath) -> Result<Metadata>;
/// Returns the canonical, absolute form of a path with all intermediate components normalized
/// and symbolic links resolved.
///
/// # Errors
/// This function will return an error in the following situations, but is not limited to just these cases:
/// * `path` does not exist.
/// * A non-final component in `path` is not a directory.
/// * the symlink target path is not valid Unicode.
fn canonicalize_path(&self, path: &SystemPath) -> Result<SystemPathBuf>;
/// Reads the content of the file at `path` into a [`String`].
fn read_to_string(&self, path: &SystemPath) -> Result<String>;