// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/Board.java
// public static final PathMatcher SOURCE_FILE_MATCHER = FileSystems.getDefault().getPathMatcher("glob:*.{c,cpp,S}");    


import static com.microchip.mplab.nbide.embedded.arduino.importer.Board.SOURCE_FILE_MATCHER;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.logging.Logger;
import java.util.stream.Collectors;
            if (opt.isPresent()) {
                Path variantPath = variantsDirPath.resolve(opt.get());
                // If the path does not exist, it might just be because of the letter casing in the variant name 
                // so go through all directories and compare their lower-case names with lower-case variant name:
                if (!Files.exists(variantPath)) {
                    String lowerCaseDirName = variantPath.getFileName().toString().toLowerCase();
                    Optional<Path> findAny = Files.list(variantsDirPath).filter(p -> p.getFileName().toString().toLowerCase().equals(lowerCaseDirName)).findAny();
                    if (findAny.isPresent()) {
                        variantPath = findAny.get();
                    } else {
                        throw new IllegalArgumentException("Did not find any variant directory for board \"" + board.getBoardId() + "\"");
                    }
                }
                return variantPath;
            } else {
                throw new IllegalArgumentException("Did not find any variant directory for board \"" + board.getBoardId() + "\"");
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

    public List<Path> getCoreFilePaths() throws IOException {
        Path variantPath = getVariantPath();
        Path corePath = getCoreDirectoryPath();

        // Find source files in variant directory:
        List<Path> variantFilePaths = new ArrayList<>();
        if (variantPath != null) {
            variantFilePaths = Files.list(variantPath)
// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/Board.java
// public static final PathMatcher SOURCE_FILE_MATCHER = FileSystems.getDefault().getPathMatcher("glob:*.{c,cpp,S}");    


// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/BoardConfiguration.java
import static com.microchip.mplab.nbide.embedded.arduino.importer.Board.SOURCE_FILE_MATCHER;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.logging.Logger;
import java.util.stream.Collectors;

            if (opt.isPresent()) {
                Path variantPath = variantsDirPath.resolve(opt.get());
                // If the path does not exist, it might just be because of the letter casing in the variant name 
                // so go through all directories and compare their lower-case names with lower-case variant name:
                if (!Files.exists(variantPath)) {
                    String lowerCaseDirName = variantPath.getFileName().toString().toLowerCase();
                    Optional<Path> findAny = Files.list(variantsDirPath).filter(p -> p.getFileName().toString().toLowerCase().equals(lowerCaseDirName)).findAny();
                    if (findAny.isPresent()) {
                        variantPath = findAny.get();
                    } else {
                        throw new IllegalArgumentException("Did not find any variant directory for board \"" + board.getBoardId() + "\"");
                    }
                }
                return variantPath;
            } else {
                throw new IllegalArgumentException("Did not find any variant directory for board \"" + board.getBoardId() + "\"");
            }
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }

    public List<Path> getCoreFilePaths() throws IOException {
        Path variantPath = getVariantPath();
        Path corePath = getCoreDirectoryPath();

        // Find source files in variant directory:
        List<Path> variantFilePaths = new ArrayList<>();
        if (variantPath != null) {
            variantFilePaths = Files.list(variantPath)
                    .filter(filePath -> SOURCE_FILE_MATCHER.matches(filePath.getFileName()))