X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fio%2FBackupFiles.java;h=c67c307d223badfe1d10349283b4a846e57aee75;hb=76fe44a302e9bd32938af7ee2b70b48d7f0d4c4b;hp=3024edf42138e8c0aadf34a7532145369ecb3e5f;hpb=5db57ea2e44da7e8f3d5ff0866b0b81cd4458aeb;p=jalview.git diff --git a/src/jalview/io/BackupFiles.java b/src/jalview/io/BackupFiles.java index 3024edf..c67c307 100644 --- a/src/jalview/io/BackupFiles.java +++ b/src/jalview/io/BackupFiles.java @@ -167,29 +167,32 @@ public class BackupFiles public static boolean hasSavesInProgress() { boolean has = false; - for (CompletableFuture cf : savesInProgressCompletableFutures()) + 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; } @@ -229,6 +232,12 @@ public class BackupFiles public BackupFiles(File file) { classInit(); + if (file.getParentFile() == null) + { + // filename probably in pwd represented with no parent -- fix it before + // it's a problem + file = file.getAbsoluteFile(); + } this.file = file; // add this file from the save in progress stack @@ -249,7 +258,8 @@ public class BackupFiles if (file != null) { String tempfilename = file.getName(); - File tempdir = file.getParentFile(); + File tempdir = file.getAbsoluteFile().getParentFile(); + tempdir.mkdirs(); Console.trace( "BACKUPFILES [file!=null] attempting to create temp file for " + tempfilename + " in dir " + tempdir); @@ -279,7 +289,7 @@ public class BackupFiles this.setTempFile(temp); } - public static void classInit() + private static void classInit() { Console.initLogger(); Console.trace("BACKUPFILES classInit");