Skip to content

Commit 4e3314b

Browse files
committed
fix symlink and directory problems in CppLibrary
1 parent 8d194a8 commit 4e3314b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818

1919
### Fixed
2020
- All test files were reporting "not ok" in TAP output. Now they are OK iff all asserts pass.
21+
- Directories with a C++ extension in their name could cause problems. Now they are ignored.
22+
- `CppLibrary` had trouble with symlinks. It shoudn't anymore.
2123

2224
### Security
2325

lib/arduino_ci/cpp_library.rb

+8-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def initialize(base_dir)
4040
# @return [Array<String>] The paths of the found files
4141
def cpp_files_in(some_dir)
4242
real = File.realpath(some_dir)
43-
Find.find(real).select { |path| CPP_EXTENSIONS.include?(File.extname(path)) }
43+
files = Find.find(real).reject { |path| File.directory?(path) }
44+
ret = files.select { |path| CPP_EXTENSIONS.include?(File.extname(path)) }
45+
ret
4446
end
4547

4648
# CPP files that are part of the project library under test
@@ -80,8 +82,11 @@ def test_files
8082
# Find all directories in the project library that include C++ header files
8183
# @return [Array<String>]
8284
def header_dirs
83-
files = Find.find(@base_dir).select { |path| HPP_EXTENSIONS.include?(File.extname(path)) }
84-
files.map { |path| File.dirname(path) }.uniq
85+
real = File.realpath(@base_dir)
86+
all_files = Find.find(real).reject { |path| File.directory?(path) }
87+
files = all_files.select { |path| HPP_EXTENSIONS.include?(File.extname(path)) }
88+
ret = files.map { |path| File.dirname(path) }.uniq
89+
ret
8590
end
8691

8792
# wrapper for the GCC command

0 commit comments

Comments
 (0)