mirror of
https://github.com/nushell/nushell.git
synced 2024-12-22 23:23:12 +01:00
nu-glob: add fs::symlink_metadata to detect broken symlinks (#5537)
* nu-glob: add fs::symlink_metadata to detect broken symlinks * fix join result
This commit is contained in:
parent
f818193b53
commit
3cef94ba39
@ -782,7 +782,11 @@ fn fill_todo(
|
||||
} else {
|
||||
path.join(&s)
|
||||
};
|
||||
if (special && is_dir) || (!special && fs::metadata(&next_path).is_ok()) {
|
||||
if (special && is_dir)
|
||||
|| (!special
|
||||
&& (fs::metadata(&next_path).is_ok()
|
||||
|| fs::symlink_metadata(&next_path).is_ok()))
|
||||
{
|
||||
add(todo, next_path);
|
||||
}
|
||||
}
|
||||
@ -966,7 +970,7 @@ mod test {
|
||||
.and_then(|p| match p.components().next().unwrap() {
|
||||
Component::Prefix(prefix_component) => {
|
||||
let path = Path::new(prefix_component.as_os_str()).join("*");
|
||||
Some(path)
|
||||
Some(path.to_path_buf())
|
||||
}
|
||||
_ => panic!("no prefix in this path"),
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user