mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
Boards Manager: package index file with name starting with "test_package_" are preserved
This commit is contained in:
parent
9d65b414b2
commit
cddfa2891e
@ -75,7 +75,7 @@ public class ContributionsIndexer {
|
||||
}
|
||||
index = parseIndex(defaultIndexFile);
|
||||
|
||||
File[] indexFiles = preferencesFolder.listFiles(new PackageIndexFilenameFilter(Constants.DEFAULT_INDEX_FILE_NAME));
|
||||
File[] indexFiles = preferencesFolder.listFiles(new TestPackageIndexFilenameFilter(new PackageIndexFilenameFilter(Constants.DEFAULT_INDEX_FILE_NAME)));
|
||||
|
||||
for (File indexFile : indexFiles) {
|
||||
ContributionsIndex contributionsIndex = parseIndex(indexFile);
|
||||
|
@ -13,6 +13,6 @@ public class PackageIndexFilenameFilter implements FilenameFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file, String name) {
|
||||
return !defaultPackageIndexFileName.equals(name) && name.startsWith("package_") && name.endsWith("_index.json");
|
||||
return new File(file, name).isFile() && !defaultPackageIndexFileName.equals(name) && name.startsWith("package_") && name.endsWith("_index.json");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cc.arduino.contributions.packages;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
|
||||
public class TestPackageIndexFilenameFilter implements FilenameFilter {
|
||||
|
||||
private final FilenameFilter parent;
|
||||
|
||||
public TestPackageIndexFilenameFilter(FilenameFilter parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public TestPackageIndexFilenameFilter() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(File file, String name) {
|
||||
boolean result = false;
|
||||
if (parent != null) {
|
||||
result = parent.accept(file, name);
|
||||
}
|
||||
result = result || (new File(file, name).isFile() && name.startsWith("test_package_") && name.endsWith("_index.json"));
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user