mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-19 00:36:10 -04:00
修复日志文件夹不存在时无法将日志写入文件的问题 (#2984)
This commit is contained in:
parent
32f8ffad46
commit
4104ca082d
@ -210,6 +210,7 @@ public final class Logger {
|
|||||||
if (logFolder != null) {
|
if (logFolder != null) {
|
||||||
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH-mm-ss"));
|
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH-mm-ss"));
|
||||||
try {
|
try {
|
||||||
|
Files.createDirectories(logFolder);
|
||||||
for (int n = 0; ; n++) {
|
for (int n = 0; ; n++) {
|
||||||
Path file = logFolder.resolve(time + (n == 0 ? "" : "." + n) + ".log").toAbsolutePath().normalize();
|
Path file = logFolder.resolve(time + (n == 0 ? "" : "." + n) + ".log").toAbsolutePath().normalize();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user