Skip to content

Commit 175650f

Browse files
committed
Cleanup the natives extraction cleanup
1 parent a0e4a0a commit 175650f

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/main/java/fr/flowarg/flowupdater/download/VanillaDownloader.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,21 @@ private void extractNatives() throws IOException
159159
natives.close();
160160
}
161161

162-
final Stream<Path> natives = FileUtils.list(this.natives).stream();
163-
natives.forEach(path -> {
164-
try {
165-
if (path.getFileName().toString().endsWith(".git") || path.getFileName().toString().endsWith(".sha1")) Files.delete(path);
166-
else if(Files.isDirectory(path)) FileUtils.deleteDirectory(path);
167-
} catch (IOException e)
168-
{
169-
this.logger.printStackTrace(e);
170-
}
171-
});
172-
173-
natives.close();
162+
try(Stream<Path> natives = Files.list(this.natives))
163+
{
164+
natives.forEach(path -> {
165+
try
166+
{
167+
if (path.getFileName().toString().endsWith(".git") || path.getFileName().toString().endsWith(".sha1"))
168+
Files.delete(path);
169+
else if(Files.isDirectory(path))
170+
FileUtils.deleteDirectory(path);
171+
} catch (IOException e)
172+
{
173+
this.logger.printStackTrace(e);
174+
}
175+
});
176+
}
174177
}
175178

176179
private void downloadAssets()

0 commit comments

Comments
 (0)