feat: add directory opening support (gerbv .)#2
Merged
rampageservices merged 3 commits intodevelopfrom Mar 6, 2026
Merged
Conversation
Allow passing a directory path as a CLI argument to load all recognized gerber, drill, and pick-and-place files from it. Detection is content-based using the existing probe functions, so extensionless and dot-prefixed files (e.g. Altium output) are handled correctly.
7064013 to
1ca0dd8
Compare
1ca0dd8 to
c2ab127
Compare
180c677 to
49d1676
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gerbv_is_loadable_file()content probe to detect gerber/drill/PnP files without relying on extensionsscan_directory()to main.c that filters directory contents through the probeCloses gerbv#308
How it works
When a CLI argument is a directory,
scan_directory()iterates its entries, probes each regular file withgerbv_is_loadable_file(), and collects matches into a sorted list. The probe reuses the exact same detection functions asgerbv_open_image(RS-274X, Excellon, PnP, RS-274D) — no extension guessing. Dot-prefixed files like.GBLand.GTL(Altium output) are included since detection is content-based.Test plan
cmake --build build— clean build, zero warningsctest— 94/104 pass (unchanged baseline)gerbv test/inputs/— loads all test gerber/drill filesgerbv .from empty dir — prints "No loadable files found"gerbv file.gbr— single file still worksgerbv --export=png -o out.png test/inputs/— directory works with export