Skip to content

Commit 747ddf6

Browse files
Copilottwistedfall
andauthored
Fix OpenCV header detection for symlinked files (#698)
* Initial plan * Fix symlink detection in files_with_predicate function Co-authored-by: twistedfall <406037+twistedfall@users.noreply.github.com> * Refactor to use is_ok_and + then pattern as requested Co-authored-by: twistedfall <406037+twistedfall@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: twistedfall <406037+twistedfall@users.noreply.github.com>
1 parent 9d3f609 commit 747ddf6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ fn files_with_predicate<'p>(
8585
Ok(dir
8686
.read_dir()?
8787
.flatten()
88-
.filter_map(|e| e.file_type().is_ok_and(|typ| typ.is_file()).then(|| e.path()))
88+
.filter_map(|e| {
89+
let path = e.path();
90+
// Use path.metadata() instead of e.file_type() to follow symlinks
91+
path.metadata().is_ok_and(|m| m.is_file()).then(|| path)
92+
})
8993
.filter(move |p| predicate(p)))
9094
}
9195

0 commit comments

Comments
 (0)