use of com.google.devtools.j2objc.util.FileUtil in project j2objc by google.
the class Options method getPathArgument.
private List<String> getPathArgument(String argument, boolean expandAarFiles, boolean expandWildcard) {
List<String> entries = new ArrayList<>();
for (String entry : Splitter.on(File.pathSeparatorChar).split(argument)) {
if (entry.startsWith("~/")) {
// Expand bash/csh tildes, which don't get expanded by the shell
// first if in the middle of a path string.
entry = System.getProperty("user.home") + entry.substring(1);
}
File f = new File(entry);
if (f.getName().equals("*") && expandWildcard) {
File parent = f.getParentFile() == null ? new File(".") : f.getParentFile();
FileFilter jarFilter = file -> file.getName().endsWith(".jar");
File[] files = parent.listFiles(jarFilter);
if (files != null) {
for (File jar : files) {
entries.add(jar.toString());
}
}
continue;
}
if (entry.endsWith(".aar") && expandAarFiles) {
// Extract classes.jar from Android library AAR file.
f = fileUtil().extractClassesJarFromAarFile(f);
}
if (f.exists()) {
entries.add(f.toString());
}
}
return entries;
}
Aggregations