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) {
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 {

View File

@ -83,8 +83,7 @@ public class UserLibrary extends ContributedLibrary {
// "arch" folder no longer supported
File archFolder = new File(libFolder, "arch");
if (archFolder.isDirectory())
throw new IOException("'arch' folder is no longer supported! See "
+ "http://goo.gl/gfFJzU for more information");
throw new IOException("'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information");
// Check mandatory properties
for (String p : MANDATORY_PROPERTIES)
@ -101,8 +100,7 @@ public class UserLibrary extends ContributedLibrary {
File utilFolder = new File(libFolder, "utility");
if (utilFolder.exists() && utilFolder.isDirectory()) {
throw new IOException(
"Library can't use both 'src' and 'utility' folders.");
throw new IOException("Library can't use both 'src' and 'utility' folders.");
}
} else {
// 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
for (File file : libFolder.listFiles()) {
if (file.isDirectory()) {
if (FileUtils.isSCCSOrHiddenFile(file)) {
File[] files = libFolder.listFiles();
if (files == null) {
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");
continue;
}
}
}
@ -131,8 +132,7 @@ public class UserLibrary extends ContributedLibrary {
if (category == null)
category = "Uncategorized";
if (!CATEGORIES.contains(category)) {
System.out.println("WARNING: Category '" + category + "' in library " +
properties.get("name") + " is not valid. Setting to 'Uncategorized'");
System.out.println("WARNING: Category '" + category + "' in library " + properties.get("name") + " is not valid. Setting to 'Uncategorized'");
category = "Uncategorized";
}