mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Added "category" field in libraries.
This commit is contained in:
parent
4932831f8b
commit
ce5ff8c299
@ -21,6 +21,7 @@ public class Library {
|
||||
private String sentence;
|
||||
private String paragraph;
|
||||
private String url;
|
||||
private String category;
|
||||
private List<String> architectures;
|
||||
private File folder;
|
||||
private File srcFolder;
|
||||
@ -31,6 +32,11 @@ public class Library {
|
||||
.asList(new String[] { "name", "version", "author", "maintainer",
|
||||
"sentence", "paragraph", "url" });
|
||||
|
||||
private static final List<String> CATEGORIES = Arrays.asList(new String[] {
|
||||
"Display", "Communication", "Signal Input/Output", "Sensors",
|
||||
"Device Control", "Timing", "Data Storage", "Data Processing", "Other",
|
||||
"Uncategorized" });
|
||||
|
||||
/**
|
||||
* Scans inside a folder and create a Library object out of it. Automatically
|
||||
* detects legacy libraries. Automatically fills metadata from
|
||||
@ -113,6 +119,12 @@ public class Library {
|
||||
for (String arch : architectures.split(","))
|
||||
archs.add(arch.trim());
|
||||
|
||||
String category = properties.get("category");
|
||||
if (category == null)
|
||||
category = "Uncategorized";
|
||||
if (!CATEGORIES.contains(category))
|
||||
category = "Uncategorized";
|
||||
|
||||
Library res = new Library();
|
||||
res.folder = libFolder;
|
||||
res.srcFolder = srcFolder;
|
||||
@ -123,6 +135,7 @@ public class Library {
|
||||
res.sentence = properties.get("sentence").trim();
|
||||
res.paragraph = properties.get("paragraph").trim();
|
||||
res.url = properties.get("url").trim();
|
||||
res.category = category.trim();
|
||||
res.architectures = archs;
|
||||
res.useRecursion = useRecursion;
|
||||
res.isLegacy = false;
|
||||
@ -183,6 +196,14 @@ public class Library {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public static List<String> getCategories() {
|
||||
return CATEGORIES;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user