Skip to content

Commit 8148676

Browse files
committed
ignore library subfolders
1 parent b7e0b61 commit 8148676

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

app/src/processing/app/Library.java

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ protected void handle() {
128128
StringDict exportTable = exportSettings.exists() ?
129129
Util.readSettings(exportSettings) : new StringDict();
130130

131-
exportList = new HashMap<String, String[]>();
131+
exportList = new HashMap<>();
132132

133133
// get the list of files just in the library root
134134
String[] baseList = libraryFolder.list(standardFilter);
@@ -298,7 +298,7 @@ public void addPackageList(Map<String, List<Library>> importToLibraryTable) {
298298
// Library library = importToLibraryTable.get(pkg);
299299
List<Library> libraries = importToLibraryTable.get(pkg);
300300
if (libraries == null) {
301-
libraries = new ArrayList<Library>();
301+
libraries = new ArrayList<>();
302302
importToLibraryTable.put(pkg, libraries);
303303
} else {
304304
if (Base.DEBUG) {
@@ -470,10 +470,10 @@ static public boolean hasMultipleArch(int platform, List<Library> libraries) {
470470

471471
static protected FilenameFilter junkFolderFilter = new FilenameFilter() {
472472
public boolean accept(File dir, String name) {
473-
// skip .DS_Store files, .svn folders, etc
473+
// skip .DS_Store files, .svn and .git folders, etc
474474
if (name.charAt(0) == '.') return false;
475-
if (name.equals("CVS")) return false;
476-
return (new File(dir, name).isDirectory());
475+
if (name.equals("CVS")) return false; // old skool
476+
return new File(dir, name).isDirectory();
477477
}
478478
};
479479

@@ -482,12 +482,14 @@ static public List<File> discover(File folder) {
482482
List<File> libraries = new ArrayList<>();
483483
String[] folderNames = folder.list(junkFolderFilter);
484484

485-
// if a bad folder or something like that, this might come back null
485+
// if a bad folder or unreadable, folderNames might be null
486486
if (folderNames != null) {
487487
// alphabetize list, since it's not always alpha order
488488
// replaced hella slow bubble sort with this feller for 0093
489489
Arrays.sort(folderNames, String.CASE_INSENSITIVE_ORDER);
490490

491+
// TODO some weirdness because ContributionType.LIBRARY.isCandidate()
492+
// handles some, but not all, of this [fry 200116]
491493
for (String potentialName : folderNames) {
492494
File baseFolder = new File(folder, potentialName);
493495
File libraryFolder = new File(baseFolder, "library");
@@ -500,22 +502,13 @@ static public List<File> discover(File folder) {
500502
libraries.add(baseFolder);
501503

502504
} else {
503-
String mess = "The library \""
504-
+ potentialName
505-
+ "\" cannot be used.\n"
506-
+ "Library names must contain only basic letters and numbers.\n"
507-
+ "(ASCII only and no spaces, and it cannot start with a number)";
505+
final String mess =
506+
"The library \"" + potentialName + "\" cannot be used.\n" +
507+
"Library names must contain only basic letters and numbers.\n" +
508+
"(ASCII only and no spaces, and it cannot start with a number)";
508509
Messages.showMessage("Ignoring bad library name", mess);
509510
continue;
510511
}
511-
/*
512-
} else { // maybe it's a JS library
513-
// TODO this should be in a better location
514-
File jsLibrary = new File(libraryFolder, potentialName + ".js");
515-
if (jsLibrary.exists()) {
516-
libraries.add(baseFolder);
517-
}
518-
*/
519512
}
520513
}
521514
}
@@ -532,6 +525,7 @@ static public List<Library> list(File folder) {
532525
libraries.add(new Library(baseFolder));
533526
}
534527

528+
/*
535529
// Support libraries inside of one level of subfolders? I believe this was
536530
// the compromise for supporting library groups, but probably a bad idea
537531
// because it's not compatible with the Manager.
@@ -548,6 +542,7 @@ static public List<Library> list(File folder) {
548542
}
549543
}
550544
}
545+
*/
551546
return libraries;
552547
}
553548

0 commit comments

Comments
 (0)