JAL-629 start of tests and more examples
[jalview.git] / src / jalview / util / FileUtils.java
index 5bc6570..9aa27f9 100644 (file)
@@ -14,6 +14,7 @@ import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
+import java.util.stream.Collectors;
 
 public class FileUtils
 {
@@ -26,7 +27,6 @@ public class FileUtils
   public static List<File> getFilesFromGlob(String pattern)
   {
     List<File> files = new ArrayList<>();
-
     /*
      * For efficiency of the Files.walkFileTree, let's find the longest path that doesn't need globbing.
      * We look for the first glob character * { ? and then look for the last File.separator before that.
@@ -102,4 +102,12 @@ public class FileUtils
 
     return files;
   }
+
+  public static List<String> getFilenamesFromGlob(String pattern)
+  {
+    // convert list of Files to list of File.getPath() Strings
+    return getFilesFromGlob(pattern).stream().map(f -> f.getPath())
+            .collect(Collectors.toList());
+  }
+
 }
\ No newline at end of file