Scan this sketch's directory for files that should be loaded as part of this sketch. Doesn't modify this SketchData instance, just returns a filtered and sorted list of File objects ready to be passed to the SketchFile constructor. @param showWarnings When true, any invalid filenames will
(boolean showWarnings)
| 104 | * When true, any invalid filenames will show a warning. |
| 105 | */ |
| 106 | private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOException { |
| 107 | Set<SketchFile> result = new TreeSet<>(CODE_DOCS_COMPARATOR); |
| 108 | for (File file : FileUtils.listFiles(folder, false, EXTENSIONS)) { |
| 109 | if (BaseNoGui.isSanitaryName(FileUtils.splitFilename(file).basename)) { |
| 110 | result.add(new SketchFile(this, file)); |
| 111 | } else if (showWarnings) { |
| 112 | System.err.println(I18n.format(tr("File name {0} is invalid: ignored"), file.getName())); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | if (result.size() == 0) |
| 117 | throw new IOException(tr("No valid code files found")); |
| 118 | |
| 119 | return new ArrayList<>(result); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Create the data folder if it does not exist already. As a |
no test coverage detected