diff --git a/plugins/TestingList.java b/plugins/TestingList.java index 49d66ca..468c1c2 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -41,6 +41,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -2380,7 +2381,7 @@ public class TestingList extends Panel { //Scan the list of devices //File[] listOfDevices = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles(); List listOfDevices = new ArrayList(); - Collections.addAll(listOfDevices, TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles()); + Collections.addAll(listOfDevices, listFilesAsArray(TESTS_DEVICES_DEFAULT_DIR.toFile(), true)); for (File deviceInList : listOfDevices) { propDevice.clear(); @@ -2416,21 +2417,39 @@ public class TestingList extends Panel { } } } - } else { // if nothing found in this directory, see if there is a subdireactory - try { - System.out.println("see subdirs of deviceInList:" + deviceInList.getPath().toString()); - System.out.println("subdirs:" + Arrays.toString(deviceInList.listFiles())); - Collections.addAll(listOfDevices, deviceInList.listFiles()); - System.out.println("new list of dirs." ); - } catch (Exception ex) { - Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); - } } } } //showEnabledTestsOnly(jCheckBoxMenuShowSelectedTests1.getState()); logger.log(Level.INFO, iCounter + " tests loaded."); } + + +public static File[] listFilesAsArray(File directory, boolean recurse) +{ + Collection files = listFiles(directory, recurse); + File[] arr = new File[files.size()]; + return (File[]) files.toArray(arr); +} + +public static Collection listFiles(File directory, boolean recurse){ + // List of files / directories + Vector files = new Vector (); + // Get files / directories in the directory + File[] entries = directory.listFiles(); + // Go over entries + for (File entry : entries){ + + files.add(entry); + // If the file is a directory and the recurse flag + // is set, recurse into the directory + if (recurse && entry.isDirectory()){ + files.addAll(listFiles(entry, recurse)); + } + } + // Return collection of files + return files; +} /** * scan tests table and see if tests/devices in the table still exist in directory. diff --git a/script/tests/tests.properties b/script/tests/tests.properties index a80c331..8c5d948 100644 --- a/script/tests/tests.properties +++ b/script/tests/tests.properties @@ -1,5 +1,5 @@ #TestingList for pshell: configuration properties -#Fri Oct 20 15:38:22 CEST 2017 +#Fri Oct 20 16:32:14 CEST 2017 customPanel= showEnabledTestsOnly=true listFilter=rps-test