Remove dependency to commons-io

This commit is contained in:
XiangRongLin 2021-01-10 20:50:38 +01:00
parent 1ea6c6ce54
commit e82cb1efea
2 changed files with 7 additions and 5 deletions

View File

@ -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'
}

View File

@ -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);
}