File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed
ilg.gnuarmeclipse.managedbuild.cross/src/ilg/gnuarmeclipse/managedbuild/cross/ui Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,6 @@ public static String discoverBuildToolsPath() {
293
293
*/
294
294
private static String getLastToolchain (String folder , final String executableName ) {
295
295
296
- List <String > list = new ArrayList <String >();
297
296
File local = new File (folder );
298
297
if (!local .isDirectory ()) {
299
298
// System.out.println(folder + " not a folder");
@@ -320,19 +319,19 @@ public boolean accept(File dir, String name) {
320
319
return null ;
321
320
}
322
321
322
+ IPath latestPath = null ;
323
+ long latestDate = 0 ;
324
+
323
325
for (int i = 0 ; i < files .length ; ++i ) {
324
- list .add (files [i ].getName ());
326
+ IPath path = (new Path (files [i ].getAbsolutePath ())).append ("bin" ).append (executableName );
327
+ long date = path .toFile ().lastModified ();
328
+ if (date > latestDate ) {
329
+ latestPath = (new Path (files [i ].getAbsolutePath ())).append ("bin" );
330
+ latestDate = date ;
331
+ }
325
332
}
326
333
327
- // The sort criteria is the lexicographical order on folder name.
328
- Collections .sort (list );
329
-
330
- // Get the last name in ordered list.
331
- String last = list .get (list .size () - 1 );
332
-
333
- // System.out.println(last);
334
- IPath path = (new Path (folder )).append (last ).append ("bin" );
335
- return path .toString ();
334
+ return latestPath .toString ();
336
335
}
337
336
338
337
/**
You can’t perform that action at this time.
0 commit comments