Merge "Get filename from File faster [DO NOT MERGE]" into klp-modular-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ffa4115a0e
@@ -116,17 +116,16 @@ public class Main {
|
|||||||
}
|
}
|
||||||
File[] possibleSdks = sdkDir.listFiles(new FileFilter() {
|
File[] possibleSdks = sdkDir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File pathname) {
|
public boolean accept(File path) {
|
||||||
return pathname.isDirectory() && pathname.getAbsolutePath().contains("android-sdk");
|
return path.isDirectory() && path.getAbsolutePath().contains("android-sdk");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (File possibleSdk : possibleSdks) {
|
for (File possibleSdk : possibleSdks) {
|
||||||
File platformsDir = new File(possibleSdk, "platforms");
|
File platformsDir = new File(possibleSdk, "platforms");
|
||||||
File[] platforms = platformsDir.listFiles(new FileFilter() {
|
File[] platforms = platformsDir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File pathname) {
|
public boolean accept(File path) {
|
||||||
return pathname.isDirectory()
|
return path.isDirectory() && path.getName().startsWith("android-");
|
||||||
&& pathname.toPath().getFileName().toString().startsWith("android-");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (platforms == null || platforms.length == 0) {
|
if (platforms == null || platforms.length == 0) {
|
||||||
@@ -137,10 +136,8 @@ public class Main {
|
|||||||
@Override
|
@Override
|
||||||
public int compare(File o1, File o2) {
|
public int compare(File o1, File o2) {
|
||||||
final int MAX_VALUE = 1000;
|
final int MAX_VALUE = 1000;
|
||||||
String suffix1 = o1.toPath().getFileName().toString()
|
String suffix1 = o1.getName().substring("android-".length());
|
||||||
.substring("android-".length());
|
String suffix2 = o2.getName().substring("android-".length());
|
||||||
String suffix2 = o2.toPath().getFileName().toString()
|
|
||||||
.substring("android-".length());
|
|
||||||
int suff1, suff2;
|
int suff1, suff2;
|
||||||
try {
|
try {
|
||||||
suff1 = Integer.parseInt(suffix1);
|
suff1 = Integer.parseInt(suffix1);
|
||||||
|
|||||||
Reference in New Issue
Block a user