Compatible Windows

":" can not write to file name if the system is windows
This commit is contained in:
1a2s3d4f1 2020-01-30 08:57:18 +08:00 committed by GitHub
parent 2d0e9af3a9
commit 1e698b9400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,6 +99,11 @@ public class BackupHelper {
} }
public static DateTimeFormatter getDateTimeFormatter(){ public static DateTimeFormatter getDateTimeFormatter(){
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm:ss"); String os = System.getProperty("os.name");
if (os.toLowerCase().startsWith("win")) {
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH-mm-ss");
} else {
return DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm:ss");
}
} }
} }