mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-08 22:52:18 -04:00
check id parent dir exists for backup
This commit is contained in:
parent
b621c86e33
commit
81fcc82972
1 changed files with 23 additions and 21 deletions
|
@ -16,10 +16,11 @@ public class FileUtil {
|
||||||
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
||||||
|
|
||||||
public static void rollingBackup(File dir, String fileName) {
|
public static void rollingBackup(File dir, String fileName) {
|
||||||
|
if (dir.exists()) {
|
||||||
File backupDir = new File(Paths.get(dir.getAbsolutePath(), "backup").toString());
|
File backupDir = new File(Paths.get(dir.getAbsolutePath(), "backup").toString());
|
||||||
if (!backupDir.exists())
|
if (!backupDir.exists())
|
||||||
if (!backupDir.mkdir())
|
if (!backupDir.mkdir())
|
||||||
log.warn("make dir failed");
|
log.warn("make dir failed.\nBackupDir=" + backupDir.getAbsolutePath());
|
||||||
|
|
||||||
File origFile = new File(Paths.get(dir.getAbsolutePath(), fileName).toString());
|
File origFile = new File(Paths.get(dir.getAbsolutePath(), fileName).toString());
|
||||||
if (origFile.exists()) {
|
if (origFile.exists()) {
|
||||||
|
@ -43,6 +44,7 @@ public class FileUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void pruneBackup(File backupDir) {
|
private static void pruneBackup(File backupDir) {
|
||||||
if (backupDir.isDirectory()) {
|
if (backupDir.isDirectory()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue