geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r701689 - /geronimo/gshell/trunk/gshell-commands/gshell-vfs/src/main/java/org/apache/geronimo/gshell/commands/vfs/ListDirectoryAction.java
Date Sat, 04 Oct 2008 19:06:56 GMT
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);



Mime
View raw message