Skip to content

Commit

Permalink
[#182] mbs.cross: default toolchain logic
Browse files Browse the repository at this point in the history
- use modified date
  • Loading branch information
ilg-ul committed Feb 24, 2017
1 parent fb3c556 commit 612ccd4
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ public static String discoverBuildToolsPath() {
*/
private static String getLastToolchain(String folder, final String executableName) {

List<String> list = new ArrayList<String>();
File local = new File(folder);
if (!local.isDirectory()) {
// System.out.println(folder + " not a folder");
Expand All @@ -320,19 +319,19 @@ public boolean accept(File dir, String name) {
return null;
}

IPath latestPath = null;
long latestDate = 0;

for (int i = 0; i < files.length; ++i) {
list.add(files[i].getName());
IPath path = (new Path(files[i].getAbsolutePath())).append("bin").append(executableName);
long date = path.toFile().lastModified();
if (date > latestDate) {
latestPath = (new Path(files[i].getAbsolutePath())).append("bin");
latestDate = date;
}
}

// The sort criteria is the lexicographical order on folder name.
Collections.sort(list);

// Get the last name in ordered list.
String last = list.get(list.size() - 1);

// System.out.println(last);
IPath path = (new Path(folder)).append(last).append("bin");
return path.toString();
return latestPath.toString();
}

/**
Expand Down

0 comments on commit 612ccd4

Please sign in to comment.