mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-20 07:20:41 -04:00
try opening wallets with all backup cache files then no cache file
This commit is contained in:
parent
b348a81f13
commit
577cfa249e
2 changed files with 91 additions and 40 deletions
|
@ -74,7 +74,7 @@ public class FileUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static File getLatestBackupFile(File dir, String fileName) {
|
||||
public static List<File> getBackupFiles(File dir, String fileName) {
|
||||
File backupDir = new File(Paths.get(dir.getAbsolutePath(), BACKUP_DIR).toString());
|
||||
if (!backupDir.exists()) return null;
|
||||
String dirName = "backups_" + fileName;
|
||||
|
@ -82,9 +82,14 @@ public class FileUtil {
|
|||
File backupFileDir = new File(Paths.get(backupDir.getAbsolutePath(), dirName).toString());
|
||||
if (!backupFileDir.exists()) return null;
|
||||
File[] files = backupFileDir.listFiles();
|
||||
if (files == null || files.length == 0) return null;
|
||||
Arrays.sort(files, Comparator.comparing(File::getName));
|
||||
return files[files.length - 1];
|
||||
return Arrays.asList(files);
|
||||
}
|
||||
|
||||
public static File getLatestBackupFile(File dir, String fileName) {
|
||||
List<File> files = getBackupFiles(dir, fileName);
|
||||
if (files.isEmpty()) return null;
|
||||
files.sort(Comparator.comparing(File::getName));
|
||||
return files.get(files.size() - 1);
|
||||
}
|
||||
|
||||
public static void deleteRollingBackup(File dir, String fileName) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue