1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Avoid warning about SCCS folders in libraries, just ignore them. Fixes #3237

This commit is contained in:
Federico Fissore
2015-05-27 11:26:00 +02:00
parent a3eae13e5d
commit 4748e9df5e
2 changed files with 19 additions and 11 deletions

View File

@ -169,7 +169,15 @@ public class FileUtils {
} }
public static boolean isSCCSOrHiddenFile(File file) { public static boolean isSCCSOrHiddenFile(File file) {
return file.isHidden() || file.getName().charAt(0) == '.' || (file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName())); return isSCCSFolder(file) || isHiddenFile(file);
}
public static boolean isHiddenFile(File file) {
return file.isHidden() || file.getName().charAt(0) == '.';
}
public static boolean isSCCSFolder(File file) {
return file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName());
} }
public static String readFileToString(File file) throws IOException { public static String readFileToString(File file) throws IOException {

View File

@ -83,8 +83,7 @@ public class UserLibrary extends ContributedLibrary {
// "arch" folder no longer supported // "arch" folder no longer supported
File archFolder = new File(libFolder, "arch"); File archFolder = new File(libFolder, "arch");
if (archFolder.isDirectory()) if (archFolder.isDirectory())
throw new IOException("'arch' folder is no longer supported! See " throw new IOException("'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information");
+ "http://goo.gl/gfFJzU for more information");
// Check mandatory properties // Check mandatory properties
for (String p : MANDATORY_PROPERTIES) for (String p : MANDATORY_PROPERTIES)
@ -101,8 +100,7 @@ public class UserLibrary extends ContributedLibrary {
File utilFolder = new File(libFolder, "utility"); File utilFolder = new File(libFolder, "utility");
if (utilFolder.exists() && utilFolder.isDirectory()) { if (utilFolder.exists() && utilFolder.isDirectory()) {
throw new IOException( throw new IOException("Library can't use both 'src' and 'utility' folders.");
"Library can't use both 'src' and 'utility' folders.");
} }
} else { } else {
// Layout with source code on library's root and "utility" folders // Layout with source code on library's root and "utility" folders
@ -110,11 +108,14 @@ public class UserLibrary extends ContributedLibrary {
} }
// Warn if root folder contains development leftovers // Warn if root folder contains development leftovers
for (File file : libFolder.listFiles()) { File[] files = libFolder.listFiles();
if (file.isDirectory()) { if (files == null) {
if (FileUtils.isSCCSOrHiddenFile(file)) { throw new IOException("Unable to list files of library in " + libFolder);
}
for (File file : files) {
if (file.isDirectory() && FileUtils.isSCCSOrHiddenFile(file)) {
if (!FileUtils.isSCCSFolder(file) && FileUtils.isHiddenFile(file)) {
System.out.println("WARNING: Spurious " + file.getName() + " folder in '" + properties.get("name") + "' library"); System.out.println("WARNING: Spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
continue;
} }
} }
} }
@ -131,8 +132,7 @@ public class UserLibrary extends ContributedLibrary {
if (category == null) if (category == null)
category = "Uncategorized"; category = "Uncategorized";
if (!CATEGORIES.contains(category)) { if (!CATEGORIES.contains(category)) {
System.out.println("WARNING: Category '" + category + "' in library " + System.out.println("WARNING: Category '" + category + "' in library " + properties.get("name") + " is not valid. Setting to 'Uncategorized'");
properties.get("name") + " is not valid. Setting to 'Uncategorized'");
category = "Uncategorized"; category = "Uncategorized";
} }