X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FBackupFiles.java;h=14c1260bbac561167382e2af1f2f2329ad79a589;hb=5aa8888ce7093703fc7e5ed4cc24d4d7059a8299;hp=88524d17d37d7a936c6ddee1c5a860cb20e17887;hpb=b364e1e6d199002069dab615d1007799b5bb71e1;p=jalview.git diff --git a/src/jalview/io/BackupFiles.java b/src/jalview/io/BackupFiles.java index 88524d1..14c1260 100644 --- a/src/jalview/io/BackupFiles.java +++ b/src/jalview/io/BackupFiles.java @@ -166,25 +166,33 @@ public class BackupFiles public static boolean hasSavesInProgress() { - return savesInProgress.size() > 0; + boolean has = false; + for (CompletableFuture cf : savesInProgressCompletableFutures(true)) + { + has |= !cf.isDone(); + } + return has; } - public static List savesInProgressFiles() + public static List savesInProgressFiles(boolean all) { List files = new ArrayList<>(); for (BackupFiles bfile : savesInProgress) { - files.add(bfile.getFile()); + if (all || !bfile.getMyFuture().isDone()) + files.add(bfile.getFile()); } return files; } - public static List> savesInProgressCompletableFutures() + public static List> savesInProgressCompletableFutures( + boolean all) { List> cfs = new ArrayList<>(); for (BackupFiles bfile : savesInProgress) { - cfs.add(bfile.getMyFuture()); + if (all || !bfile.getMyFuture().isDone()) + cfs.add(bfile.getMyFuture()); } return cfs; } @@ -245,6 +253,7 @@ public class BackupFiles { String tempfilename = file.getName(); File tempdir = file.getParentFile(); + tempdir.mkdirs(); Console.trace( "BACKUPFILES [file!=null] attempting to create temp file for " + tempfilename + " in dir " + tempdir);