mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Replace some FileUtils calls with direct methods
Not wrapping these calls in FileUtils methods makes the code cleaner and easier to understand (FileUtils is very poorly documented, whereas direct calls contain proper documentation).
This commit is contained in:
parent
e2d2998075
commit
4c2fca6457
@ -1691,19 +1691,12 @@ public class Base {
|
||||
});
|
||||
|
||||
boolean ifound = false;
|
||||
|
||||
for (File subfolder : files) {
|
||||
if (FileUtils.isSCCSOrHiddenFile(subfolder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!subfolder.isDirectory()) continue;
|
||||
|
||||
if (addSketchesSubmenu(menu, subfolder.getName(), subfolder)) {
|
||||
if (!FileUtils.isSCCSOrHiddenFile(subfolder) && subfolder.isDirectory()
|
||||
&& addSketchesSubmenu(menu, subfolder.getName(), subfolder)) {
|
||||
ifound = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ifound;
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,19 @@
|
||||
|
||||
package cc.arduino.packages.uploaders;
|
||||
|
||||
import processing.app.helpers.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
public class MergeSketchWithBooloader {
|
||||
|
||||
public void merge(File sketch, File bootloader) throws IOException {
|
||||
List<String> mergedSketch = FileUtils.readFileToListOfStrings(sketch);
|
||||
List<String> mergedSketch = Files.readAllLines(sketch.toPath(), StandardCharsets.UTF_8);
|
||||
mergedSketch.remove(mergedSketch.size() - 1);
|
||||
mergedSketch.addAll(FileUtils.readFileToListOfStrings(bootloader));
|
||||
mergedSketch.addAll(Files.readAllLines(bootloader.toPath(), StandardCharsets.UTF_8));
|
||||
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
|
@ -485,8 +485,8 @@ public class BaseNoGui {
|
||||
} catch (JsonProcessingException | SignatureVerificationFailedException e) {
|
||||
File indexFile = indexer.getIndexFile(Constants.DEFAULT_INDEX_FILE_NAME);
|
||||
File indexSignatureFile = indexer.getIndexFile(Constants.DEFAULT_INDEX_FILE_NAME + ".sig");
|
||||
FileUtils.deleteIfExists(indexFile);
|
||||
FileUtils.deleteIfExists(indexSignatureFile);
|
||||
indexFile.delete();
|
||||
indexSignatureFile.delete();
|
||||
throw e;
|
||||
}
|
||||
indexer.syncWithFilesystem();
|
||||
@ -502,7 +502,7 @@ public class BaseNoGui {
|
||||
librariesIndexer.parseIndex();
|
||||
} catch (JsonProcessingException e) {
|
||||
File librariesIndexFile = librariesIndexer.getIndexFile();
|
||||
FileUtils.deleteIfExists(librariesIndexFile);
|
||||
librariesIndexFile.delete();
|
||||
}
|
||||
|
||||
if (discoveryManager == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user