промежуточный. улучшение удаления баг репортов, в процессе отображения диалогового окна
This commit is contained in:
@@ -1249,5 +1249,42 @@ public class Utils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
private static void get_newest_file_date_r(File dir, Vector<Long> dates){
|
||||
Vector<File> files= new Vector(Arrays.asList(dir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.isFile();
|
||||
}
|
||||
})));
|
||||
if (!files.isEmpty()) {
|
||||
files.sort(new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
return Long.compare(o1.lastModified(), o2.lastModified());
|
||||
}
|
||||
}.reversed());
|
||||
dates.add(files.firstElement().lastModified());
|
||||
}
|
||||
//--
|
||||
Vector<File> subdirs= new Vector(Arrays.asList(dir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.isDirectory();
|
||||
}
|
||||
})));
|
||||
if (!subdirs.isEmpty()){
|
||||
for (File subdir: subdirs)
|
||||
get_newest_file_date_r(subdir, dates);
|
||||
}
|
||||
}
|
||||
public static long getNewestFileDate(File dir){
|
||||
Vector<Long> dates = new Vector<>();
|
||||
dates.add(dir.lastModified());
|
||||
get_newest_file_date_r(dir, dates);
|
||||
Collections.sort(dates);
|
||||
System.out.println(new Date(dates.lastElement()));
|
||||
return dates.firstElement();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user