Skip to content

Commit 4748e9d

Browse files
author
Federico Fissore
committed
Avoid warning about SCCS folders in libraries, just ignore them. Fixes #3237
1 parent a3eae13 commit 4748e9d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

Diff for: arduino-core/src/processing/app/helpers/FileUtils.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,15 @@ public static String getLinuxPathFrom(File file) {
169169
}
170170

171171
public static boolean isSCCSOrHiddenFile(File file) {
172-
return file.isHidden() || file.getName().charAt(0) == '.' || (file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName()));
172+
return isSCCSFolder(file) || isHiddenFile(file);
173+
}
174+
175+
public static boolean isHiddenFile(File file) {
176+
return file.isHidden() || file.getName().charAt(0) == '.';
177+
}
178+
179+
public static boolean isSCCSFolder(File file) {
180+
return file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName());
173181
}
174182

175183
public static String readFileToString(File file) throws IOException {

Diff for: arduino-core/src/processing/app/packages/UserLibrary.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ public static UserLibrary create(File libFolder) throws IOException {
8383
// "arch" folder no longer supported
8484
File archFolder = new File(libFolder, "arch");
8585
if (archFolder.isDirectory())
86-
throw new IOException("'arch' folder is no longer supported! See "
87-
+ "http://goo.gl/gfFJzU for more information");
86+
throw new IOException("'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information");
8887

8988
// Check mandatory properties
9089
for (String p : MANDATORY_PROPERTIES)
@@ -101,20 +100,22 @@ public static UserLibrary create(File libFolder) throws IOException {
101100

102101
File utilFolder = new File(libFolder, "utility");
103102
if (utilFolder.exists() && utilFolder.isDirectory()) {
104-
throw new IOException(
105-
"Library can't use both 'src' and 'utility' folders.");
103+
throw new IOException("Library can't use both 'src' and 'utility' folders.");
106104
}
107105
} else {
108106
// Layout with source code on library's root and "utility" folders
109107
layout = LibraryLayout.FLAT;
110108
}
111109

112110
// Warn if root folder contains development leftovers
113-
for (File file : libFolder.listFiles()) {
114-
if (file.isDirectory()) {
115-
if (FileUtils.isSCCSOrHiddenFile(file)) {
111+
File[] files = libFolder.listFiles();
112+
if (files == null) {
113+
throw new IOException("Unable to list files of library in " + libFolder);
114+
}
115+
for (File file : files) {
116+
if (file.isDirectory() && FileUtils.isSCCSOrHiddenFile(file)) {
117+
if (!FileUtils.isSCCSFolder(file) && FileUtils.isHiddenFile(file)) {
116118
System.out.println("WARNING: Spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
117-
continue;
118119
}
119120
}
120121
}
@@ -131,8 +132,7 @@ public static UserLibrary create(File libFolder) throws IOException {
131132
if (category == null)
132133
category = "Uncategorized";
133134
if (!CATEGORIES.contains(category)) {
134-
System.out.println("WARNING: Category '" + category + "' in library " +
135-
properties.get("name") + " is not valid. Setting to 'Uncategorized'");
135+
System.out.println("WARNING: Category '" + category + "' in library " + properties.get("name") + " is not valid. Setting to 'Uncategorized'");
136136
category = "Uncategorized";
137137
}
138138

0 commit comments

Comments
 (0)