Added option for persistent resources like configuration files
This commit is contained in:
@@ -14,7 +14,7 @@ import java.util.stream.Stream;
|
||||
* Class from the Minestom Arena example
|
||||
*/
|
||||
public final class ResourceUtils {
|
||||
public static void extractResource(String source) throws URISyntaxException, IOException {
|
||||
public static void extractResource(String source, boolean keepOutdated) throws URISyntaxException, IOException {
|
||||
final URI uri = Objects.requireNonNull(ResourceUtils.class.getResource("/" + source)).toURI();
|
||||
FileSystem fileSystem = null;
|
||||
|
||||
@@ -27,6 +27,7 @@ public final class ResourceUtils {
|
||||
final Path jarPath = Paths.get(uri);
|
||||
final Path target = Path.of("resources/" + source);
|
||||
if (Files.exists(target)) {
|
||||
if(keepOutdated) return;
|
||||
try (Stream<Path> pathStream = Files.walk(target)) {
|
||||
pathStream.sorted(Comparator.reverseOrder())
|
||||
.forEach(path -> {
|
||||
|
||||
Reference in New Issue
Block a user