mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-21 15:54:39 +01:00
Changed 'fat' (multiplatform) library detection algorithm
This commit is contained in:
parent
5c0eca5fa7
commit
3d9672d902
@ -996,6 +996,9 @@ public class Base {
|
|||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
File folder = ideLibs.get(name);
|
File folder = ideLibs.get(name);
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
addSketchesSubmenu(menu, name, folder, false);
|
||||||
|
// Allows "fat" libraries to have examples in the root folder
|
||||||
|
if (folder.getName().equals(Base.getTargetPlatform()))
|
||||||
|
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, File> userLibs = getUserLibs();
|
Map<String, File> userLibs = getUserLibs();
|
||||||
@ -1006,6 +1009,9 @@ public class Base {
|
|||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
File folder = userLibs.get(name);
|
File folder = userLibs.get(name);
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
addSketchesSubmenu(menu, name, folder, false);
|
||||||
|
// Allows "fat" libraries to have examples in the root folder
|
||||||
|
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
||||||
|
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -1048,10 +1054,22 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File scanFatLibrary(File libFolder) {
|
public File scanFatLibrary(File libFolder) {
|
||||||
// Fat libraries must have metadata.txt file
|
// A library is considered "fat" if there are folders besides
|
||||||
File propFile = new File(libFolder, "metadata.txt");
|
// examples and utility
|
||||||
if (!propFile.exists())
|
boolean fat = false;
|
||||||
|
String[] folders = libFolder.list(new OnlyDirs());
|
||||||
|
for (String folder : folders) {
|
||||||
|
if (folder.equals("examples"))
|
||||||
|
continue;
|
||||||
|
if (folder.equals("utility"))
|
||||||
|
continue;
|
||||||
|
fat = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fat)
|
||||||
return libFolder;
|
return libFolder;
|
||||||
|
|
||||||
// Search for a subfolder for actual architecture, return null if not found
|
// Search for a subfolder for actual architecture, return null if not found
|
||||||
File archSubfolder = new File(libFolder, Base.getTargetPlatform().getName());
|
File archSubfolder = new File(libFolder, Base.getTargetPlatform().getName());
|
||||||
if (!archSubfolder.exists() || !archSubfolder.isDirectory())
|
if (!archSubfolder.exists() || !archSubfolder.isDirectory())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user