From ac9706b83fce1621264a0df311824ea0fedab6e7 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 10 Aug 2020 22:29:12 +0100 Subject: [PATCH] Ignore FileAlreadyExistsException in MoreFiles#createDirectories (#2525) --- .../me/lucko/luckperms/common/util/MoreFiles.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/util/MoreFiles.java b/common/src/main/java/me/lucko/luckperms/common/util/MoreFiles.java index 3521691ab..0622f931e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/util/MoreFiles.java +++ b/common/src/main/java/me/lucko/luckperms/common/util/MoreFiles.java @@ -27,6 +27,7 @@ package me.lucko.luckperms.common.util; import java.io.IOException; import java.nio.file.DirectoryStream; +import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; @@ -45,7 +46,12 @@ public final class MoreFiles { return path; } - Files.createDirectory(path); + try { + Files.createDirectory(path); + } catch (FileAlreadyExistsException e) { + // ignore + } + return path; } @@ -54,7 +60,12 @@ public final class MoreFiles { return path; } - Files.createDirectories(path); + try { + Files.createDirectories(path); + } catch (FileAlreadyExistsException e) { + // ignore + } + return path; }