geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r700086 - /geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
Date Mon, 29 Sep 2008 12:16:13 GMT
Author: jdillon
Date: Mon Sep 29 05:16:12 2008
New Revision: 700086

URL: http://svn.apache.org/viewvc?rev=700086&view=rev
Log:
Optimize a wee bit

Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java

Modified: geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java?rev=700086&r1=700085&r2=700086&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
Mon Sep 29 05:16:12 2008
@@ -85,16 +85,27 @@
         assert dir != null;
         assert prefix != null;
 
-        FileFilter filter = new FileFilter() {
-            public boolean accept(final FileSelectInfo selection) {
-                assert selection != null;
+        FileObject[] files;
 
-                // When includeHidden only include the file if there is not "." prefix, else
include everything
-                return includeHidden || !selection.getFile().getName().getBaseName().startsWith(".");
-            }
-        };
+        if (includeHidden) {
+            files = dir.getChildren();
+        }
+        else {
+            FileFilter filter = new FileFilter() {
+                public boolean accept(final FileSelectInfo selection) {
+                    assert selection != null;
+
+                    try {
+                        return !selection.getFile().isHidden();
+                    }
+                    catch (FileSystemException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+            };
 
-        FileObject[] files = dir.findFiles(new FileFilterSelector(filter));
+            files = dir.findFiles(new FileFilterSelector(filter));
+        }
 
         for (FileObject file : files) {
             io.out.print(prefix);



Mime
View raw message