Skip to content

Commit 13d8214

Browse files
committed
Backported OnlyDirs.class
1 parent 5444455 commit 13d8214

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

app/src/processing/app/Base.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import processing.app.debug.Compiler;
3434
import processing.app.debug.Target;
3535
import processing.app.helpers.FileUtils;
36+
import processing.app.helpers.filefilters.OnlyDirs;
3637
import processing.app.tools.ZipDeflater;
3738
import processing.core.*;
3839
import static processing.app.I18n._;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
OnlyDirs - FilenameFilter that accepts only directories (CVS, .svn,
3+
.DS_Store files are excluded as well)
4+
Part of the Arduino project - http://www.arduino.cc/
5+
6+
Copyright (c) 2011 Cristian Maglie
7+
8+
This program is free software; you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 2 of the License, or
11+
(at your option) any later version.
12+
13+
This program is distributed in the hope that it will be useful,
14+
but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
GNU General Public License for more details.
17+
18+
You should have received a copy of the GNU General Public License
19+
along with this program; if not, write to the Free Software Foundation,
20+
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21+
*/
22+
package processing.app.helpers.filefilters;
23+
24+
import java.io.File;
25+
import java.io.FilenameFilter;
26+
27+
/**
28+
* This filter accepts only directories (excluding .DS_Store files, .svn
29+
* folders, etc)
30+
*
31+
* @author Cristian Maglie
32+
*/
33+
public class OnlyDirs implements FilenameFilter {
34+
35+
public boolean accept(File dir, String name) {
36+
if (name.charAt(0) == '.')
37+
return false;
38+
if (name.equals("CVS"))
39+
return false;
40+
return new File(dir, name).isDirectory();
41+
}
42+
}

0 commit comments

Comments
 (0)