Skip to content
Snippets Groups Projects
Commit 89bd43fe authored by stepan's avatar stepan
Browse files

Support ignoreCase in list.files function

parent a5a1bbaa
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1995-2012, The R Core Team
* Copyright (c) 2003, The R Foundation
* Copyright (c) 2013, 2017, Oracle and/or its affiliates
* Copyright (c) 2013, 2018, Oracle and/or its affiliates
*
* All rights reserved.
*/
......@@ -634,11 +634,10 @@ public class FileFunctions {
}
private RStringVector doListFilesBody(RAbstractStringVector vec, String patternString, boolean allFiles, boolean fullNames, boolean recursive,
boolean ignoreCaseIn, boolean includeDirsIn, boolean noDotDot) {
boolean ignoreCase, boolean includeDirsIn, boolean noDotDot) {
boolean includeDirs = !recursive || includeDirsIn;
@SuppressWarnings("unused")
boolean ignoreCase = check(ignoreCaseIn, "ignoreCase");
Pattern pattern = patternString == null ? null : Pattern.compile(patternString);
int flags = ignoreCase ? Pattern.CASE_INSENSITIVE : 0;
Pattern pattern = patternString == null ? null : Pattern.compile(patternString, flags);
// Curiously the result is not a vector of same length as the input,
// as typical for R, but a single vector, which means duplicates may occur
ArrayList<String> files = new ArrayList<>();
......@@ -693,13 +692,6 @@ public class FileFunctions {
}
}
private boolean check(boolean value, String argName) {
if (value) {
warning(RError.Message.GENERIC, "'" + argName + "'" + " is not implemented");
}
return value;
}
private static class FileMatcher implements BiPredicate<Path, BasicFileAttributes> {
final Pattern pattern;
final boolean includeDirs;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment