1 /*
2 * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
307 }
308 entries[i].delete();
309 }
310 dir.delete();
311 }
312 }
313
314 static List<File> findFiles(File startDir, FileFilter filter)
315 throws IOException {
316 List<File> list = new ArrayList<File>();
317 findFiles0(startDir, list, filter);
318 return list;
319 }
320 /*
321 * finds files in the start directory using the the filter, appends
322 * the files to the dirList.
323 */
324 private static void findFiles0(File startDir, List<File> list,
325 FileFilter filter) throws IOException {
326 File[] foundFiles = startDir.listFiles(filter);
327 list.addAll(Arrays.asList(foundFiles));
328 File[] dirs = startDir.listFiles(DIR_FILTER);
329 for (File dir : dirs) {
330 findFiles0(dir, list, filter);
331 }
332 }
333
334 static void close(Closeable c) {
335 if (c == null) {
336 return;
337 }
338 try {
339 c.close();
340 } catch (IOException ignore) {
341 }
342 }
343
344 static void compiler(String... javacCmds) {
345 List<String> cmdList = new ArrayList<>();
346 cmdList.add(getJavacCmd());
|
1 /*
2 * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
307 }
308 entries[i].delete();
309 }
310 dir.delete();
311 }
312 }
313
314 static List<File> findFiles(File startDir, FileFilter filter)
315 throws IOException {
316 List<File> list = new ArrayList<File>();
317 findFiles0(startDir, list, filter);
318 return list;
319 }
320 /*
321 * finds files in the start directory using the the filter, appends
322 * the files to the dirList.
323 */
324 private static void findFiles0(File startDir, List<File> list,
325 FileFilter filter) throws IOException {
326 File[] foundFiles = startDir.listFiles(filter);
327 if (foundFiles == null) {
328 return;
329 }
330 list.addAll(Arrays.asList(foundFiles));
331 File[] dirs = startDir.listFiles(DIR_FILTER);
332 for (File dir : dirs) {
333 findFiles0(dir, list, filter);
334 }
335 }
336
337 static void close(Closeable c) {
338 if (c == null) {
339 return;
340 }
341 try {
342 c.close();
343 } catch (IOException ignore) {
344 }
345 }
346
347 static void compiler(String... javacCmds) {
348 List<String> cmdList = new ArrayList<>();
349 cmdList.add(getJavacCmd());
|