mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
return empty list if no backup files exist
Some checks are pending
Some checks are pending
This commit is contained in:
parent
023e2bcd2f
commit
5221782ba0
1 changed files with 3 additions and 2 deletions
|
@ -32,6 +32,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -76,11 +77,11 @@ public class FileUtil {
|
||||||
|
|
||||||
public static List<File> getBackupFiles(File dir, String fileName) {
|
public static List<File> getBackupFiles(File dir, String fileName) {
|
||||||
File backupDir = new File(Paths.get(dir.getAbsolutePath(), BACKUP_DIR).toString());
|
File backupDir = new File(Paths.get(dir.getAbsolutePath(), BACKUP_DIR).toString());
|
||||||
if (!backupDir.exists()) return null;
|
if (!backupDir.exists()) return new ArrayList<File>();
|
||||||
String dirName = "backups_" + fileName;
|
String dirName = "backups_" + fileName;
|
||||||
if (dirName.contains(".")) dirName = dirName.replace(".", "_");
|
if (dirName.contains(".")) dirName = dirName.replace(".", "_");
|
||||||
File backupFileDir = new File(Paths.get(backupDir.getAbsolutePath(), dirName).toString());
|
File backupFileDir = new File(Paths.get(backupDir.getAbsolutePath(), dirName).toString());
|
||||||
if (!backupFileDir.exists()) return null;
|
if (!backupFileDir.exists()) return new ArrayList<File>();
|
||||||
File[] files = backupFileDir.listFiles();
|
File[] files = backupFileDir.listFiles();
|
||||||
return Arrays.asList(files);
|
return Arrays.asList(files);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue