Skip to content

Commit a4a6601

Browse files
Don't forbid unknown files in a library
The current code forbids any files it does not know about, but this is bad because: - It breaks forward compatibility if we later add more files or directories to the library format. - It breaks for people who want to have some extra stuff in their library (say, .gitignore or a README file). We can't keep a list of "allowed" stuff, since there will always be stuff missing. This commit removes that code and just allows all files again.
1 parent 3283206 commit a4a6601

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

app/src/processing/app/packages/Library.java

-20
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public class Library {
3131
.asList(new String[] { "architectures", "author", "core-dependencies",
3232
"dependencies", "email", "name", "paragraph", "sentence", "url",
3333
"version" });
34-
private static final List<String> OPTIONAL_FOLDERS = Arrays
35-
.asList(new String[] { "arch", "examples", "extras", "src" });
36-
private static final List<String> OPTIONAL_FILES = Arrays
37-
.asList(new String[] { "keywords.txt", "library.properties" });
38-
3934

4035
/**
4136
* Scans inside a folder and create a Library object out of it. Automatically
@@ -74,21 +69,6 @@ private static Library createLibrary(File libFolder) throws IOException {
7469
if (!srcFolder.exists() || !srcFolder.isDirectory())
7570
throw new IOException("Missing 'src' folder");
7671

77-
// 3. check if root folder contains prohibited stuff
78-
for (File file : libFolder.listFiles()) {
79-
if (file.isDirectory()) {
80-
if (FileUtils.isSCCSOrHiddenFile(file)) {
81-
System.out.println("WARNING: Ignoring spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
82-
continue;
83-
}
84-
if (!OPTIONAL_FOLDERS.contains(file.getName()))
85-
throw new IOException("Invalid folder '" + file.getName() + "'.");
86-
} else {
87-
if (!OPTIONAL_FILES.contains(file.getName()))
88-
throw new IOException("Invalid file '" + file.getName() + "'.");
89-
}
90-
}
91-
9272
// Extract metadata info
9373
List<String> archs = new ArrayList<String>();
9474
for (String arch : properties.get("architectures").split(","))

0 commit comments

Comments
 (0)