You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/04 21:06:56 UTC

svn commit: r701689 - /geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java

Author: jdillon
Date: Sat Oct  4 12:06:56 2008
New Revision: 701689

URL: http://svn.apache.org/viewvc?rev=701689&view=rev
Log:
Fixed ls bug where directory is displayed twice

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=701689&r1=701688&r2=701689&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 Sat Oct  4 12:06:56 2008
@@ -134,15 +134,22 @@
         List<FileObject> dirs = new LinkedList<FileObject>();
 
         for (FileObject file : files) {
-            names.add(file.getName().getBaseName());
+            FileType type = file.getType();
 
-            if (file.getType() == FileType.FOLDER) {
+            if (type == FileType.FILE) {
+                names.add(file.getName().getBaseName());
+
+            }
+            else if (type == FileType.FOLDER) {
                 names.add(file.getName().getBaseName() + "/");
 
                 if (recursive) {
                     dirs.add(file);
                 }
             }
+            else {
+                log.warn("Unable to handle file type: {}", type);
+            }
         }
 
         reader.printColumns(names);