Ignore FileAlreadyExistsException in MoreFiles#createDirectories (#2525)

This commit is contained in:
Luck 2020-08-10 22:29:12 +01:00
parent fea757887c
commit ac9706b83f
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -27,6 +27,7 @@ package me.lucko.luckperms.common.util;
import java.io.IOException; import java.io.IOException;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -45,7 +46,12 @@ public final class MoreFiles {
return path; return path;
} }
Files.createDirectory(path); try {
Files.createDirectory(path);
} catch (FileAlreadyExistsException e) {
// ignore
}
return path; return path;
} }
@ -54,7 +60,12 @@ public final class MoreFiles {
return path; return path;
} }
Files.createDirectories(path); try {
Files.createDirectories(path);
} catch (FileAlreadyExistsException e) {
// ignore
}
return path; return path;
} }