mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
[FEATURE] Added Directories#listFilesWithExtension
This commit is contained in:
@@ -304,4 +304,23 @@ public class Directories {
|
||||
Core.verbose("File is deleted : " + file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of files with from a given directory and a given extension
|
||||
*
|
||||
* @param directory The directory where should be searched
|
||||
* @param extension The extension to be searched for, including the dot (like .json)
|
||||
* @return An array of of files that match the request
|
||||
*/
|
||||
private File[] listFilesWithExtension(File directory, final String extension){
|
||||
return directory.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String filename) {
|
||||
return filename.endsWith(extension);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private File[] listJSONFiles(File directory) {
|
||||
return listFilesWithExtension(directory, ".json");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.parabot.core.parsers.servers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -64,7 +66,7 @@ public class LocalServers extends ServerParser {
|
||||
}
|
||||
}
|
||||
|
||||
// for ()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user