Skip to content

feat: open directory of gerber files (gerbv .) #308

@rampageservices

Description

@rampageservices

Problem

Running gerbv . or gerbv ./gerbers/ treats the argument as a filename, which fails. There's no way to open all gerber files in a directory without listing them individually.

This is a familiar pattern from other tools — code . opens VS Code with the current directory's contents, vim . opens netrw, etc. gerbv should support the same convention: pass a directory and it loads everything it recognizes from it.

Why content-based detection matters

Gerber files have wildly inconsistent naming across EDA tools. Altium outputs files like .GBL, .GTL, .GTO (dot-prefixed, no basename). Some shops produce extensionless files. Extension-based filtering would miss these — the only reliable approach is to probe file contents using the same detection logic gerbv already uses internally (RS-274X, Excellon, pick-and-place, RS-274D signatures).

Expected behavior

Command Result
`gerbv .` Load all recognized files from CWD
`gerbv ./gerbers/` Load all recognized files from `gerbers/`
`gerbv file.gbr` Unchanged — single file
`gerbv ./gerbers/ extra.gbr` Directory contents + extra file
`gerbv --export=png -o out.png ./gerbers/` Directory works with CLI export mode
`gerbv empty-dir/` Prints "No loadable files found", opens empty
  • Non-matching files (READMEs, images, Makefiles) are silently skipped
  • Dot-prefixed gerber files (`.GBL`, `.GTL`) are included
  • Files are loaded in alphabetical order for predictable layer ordering
  • Not recursive — only the specified directory level

Export mode

Directory arguments work with `--export` the same way individual files do. All files from the directory are loaded as layers and composited into a single output — the same stacked, color-coded view you see in the GUI:

```bash

These are equivalent:

gerbv --export=png -o board.png ./gerbers/
gerbv --export=png -o board.png gerbers/copper.gbr gerbers/mask.gbr gerbers/drill.drl
```

This is consistent with how `code .` works — it doesn't open each file in a separate window, it opens one workspace with all the files loaded. Similarly, `gerbv .` opens one viewer with all recognized layers loaded and stacked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions