MCPcopy Index your code
hub / github.com/arduino/Arduino / listSketchFiles

Method listSketchFiles

arduino-core/src/processing/app/Sketch.java:106–120  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 2

SketchMethod · 0.95
reloadMethod · 0.95

Calls 8

listFilesMethod · 0.95
isSanitaryNameMethod · 0.95
splitFilenameMethod · 0.95
formatMethod · 0.95
trMethod · 0.80
sizeMethod · 0.80
getNameMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected