forked from extern/nushell
Fix path_contains_hidden_folder (#6173)
* Fix path_contains_hidden_folder Signed-off-by: nibon7 <nibon7@163.com> * add test Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
@ -343,11 +343,7 @@ fn is_hidden_dir(dir: impl AsRef<Path>) -> bool {
|
||||
}
|
||||
|
||||
fn path_contains_hidden_folder(path: &Path, folders: &[PathBuf]) -> bool {
|
||||
let path_str = path.to_str().expect("failed to read path");
|
||||
if folders
|
||||
.iter()
|
||||
.any(|p| path_str.starts_with(&p.to_str().expect("failed to read hidden paths")))
|
||||
{
|
||||
if folders.iter().any(|p| path.starts_with(p.as_path())) {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
|
Reference in New Issue
Block a user