From a4a660154ec52f8349f9d412b393b3258aeb7468 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 19 Nov 2013 17:36:15 +0100 Subject: [PATCH] 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. --- app/src/processing/app/packages/Library.java | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/app/src/processing/app/packages/Library.java b/app/src/processing/app/packages/Library.java index 839377448..e70a62e03 100644 --- a/app/src/processing/app/packages/Library.java +++ b/app/src/processing/app/packages/Library.java @@ -31,11 +31,6 @@ public class Library { .asList(new String[] { "architectures", "author", "core-dependencies", "dependencies", "email", "name", "paragraph", "sentence", "url", "version" }); - private static final List OPTIONAL_FOLDERS = Arrays - .asList(new String[] { "arch", "examples", "extras", "src" }); - private static final List OPTIONAL_FILES = Arrays - .asList(new String[] { "keywords.txt", "library.properties" }); - /** * Scans inside a folder and create a Library object out of it. Automatically @@ -74,21 +69,6 @@ public class Library { if (!srcFolder.exists() || !srcFolder.isDirectory()) throw new IOException("Missing 'src' folder"); - // 3. check if root folder contains prohibited stuff - for (File file : libFolder.listFiles()) { - if (file.isDirectory()) { - if (FileUtils.isSCCSOrHiddenFile(file)) { - System.out.println("WARNING: Ignoring spurious " + file.getName() + " folder in '" + properties.get("name") + "' library"); - continue; - } - if (!OPTIONAL_FOLDERS.contains(file.getName())) - throw new IOException("Invalid folder '" + file.getName() + "'."); - } else { - if (!OPTIONAL_FILES.contains(file.getName())) - throw new IOException("Invalid file '" + file.getName() + "'."); - } - } - // Extract metadata info List archs = new ArrayList(); for (String arch : properties.get("architectures").split(","))