From e82cb1efeaf34a87072b6424aad4671796697396 Mon Sep 17 00:00:00 2001 From: XiangRongLin <41164160+XiangRongLin@users.noreply.github.com> Date: Sun, 10 Jan 2021 20:50:38 +0100 Subject: [PATCH] Remove dependency to commons-io --- extractor/build.gradle | 1 - .../newpipe/downloader/RecordingDownloader.java | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extractor/build.gradle b/extractor/build.gradle index 1b5b82ffc..58063bba0 100644 --- a/extractor/build.gradle +++ b/extractor/build.gradle @@ -10,5 +10,4 @@ dependencies { testImplementation 'junit:junit:4.13.1' testImplementation "com.squareup.okhttp3:okhttp:3.12.11" testImplementation 'com.google.code.gson:gson:2.8.6' - testImplementation 'commons-io:commons-io:2.8.0' } diff --git a/extractor/src/test/java/org/schabi/newpipe/downloader/RecordingDownloader.java b/extractor/src/test/java/org/schabi/newpipe/downloader/RecordingDownloader.java index 9988db8b6..c48d74990 100644 --- a/extractor/src/test/java/org/schabi/newpipe/downloader/RecordingDownloader.java +++ b/extractor/src/test/java/org/schabi/newpipe/downloader/RecordingDownloader.java @@ -2,7 +2,6 @@ package org.schabi.newpipe.downloader; import com.google.gson.GsonBuilder; -import org.apache.commons.io.FileUtils; import org.schabi.newpipe.extractor.downloader.Downloader; import org.schabi.newpipe.extractor.downloader.Request; import org.schabi.newpipe.extractor.downloader.Response; @@ -27,9 +26,13 @@ class RecordingDownloader extends Downloader { public RecordingDownloader(String stringPath) throws IOException { this.path = stringPath; Path path = Paths.get(stringPath); - File directory = path.toFile(); - if (directory.exists()) { - FileUtils.cleanDirectory(directory); + File folder = path.toFile(); + if (folder.exists()) { + for (File file : folder.listFiles()) { + if (file.getName().startsWith(RecordingDownloader.FILE_NAME_PREFIX)) { + file.delete(); + } + } } Files.createDirectories(path); }