- /** This is the method required by FileNameFilter.\r
- To get a listing of files in the current directory\r
- ending in .java, do this:\r
- <pre>\r
- File dot = new File(".");\r
- FileRegex java_files = new FileRegex("*.java");\r
- String[] file_list = dot.list(java_files);\r
- </pre>\r
- */\r
- public boolean accept(File dir,String s) {\r
- if(dirflag != EITHER) {\r
- File f = new File(s);\r
- if(f.isDirectory() && dirflag == NONDIR)\r
- return false;\r
- if(!f.isDirectory() && dirflag == DIR)\r
- return false;\r
- }\r
- return matchAt(s,0);\r
+ return matchAt(s, 0);\r
+ }\r
+\r
+ int dirflag = 0;\r
+ final static int EITHER = 0, DIR = 1, NONDIR = 2;\r
+\r
+ /** Provides an alternative to File.list -- this\r
+ separates its argument according to File.pathSeparator.\r
+ To each path, it splits off a directory -- all characters\r
+ up to and including the first instance of File.separator --\r
+ and a file pattern -- the part that comes after the directory.\r
+ It then produces a list of all the pattern matches on all\r
+ the paths. Thus "*.java:../*.java" would produce a list of\r
+ all the java files in this directory and in the ".." directory\r
+ on a Unix machine. "*.java;..\\*.java" would do the same thing\r
+ on a Dos machine. */\r
+ public static String[] list(String f)\r
+ {\r
+ return list(f, EITHER);\r
+ }\r
+\r
+ static String[] list(String f, int df)\r
+ {\r
+ //return list_(f,new FileRegex());\r
+ StringTokenizer st = new StringTokenizer(f, File.pathSeparator);\r
+ Vector v = new Vector();\r
+ while (st.hasMoreTokens())\r
+ {\r
+ String path = st.nextToken();\r
+ list1(path, v, df, true);\r