Проверку директорий осуществляет FileDownloader
This commit is contained in:
@@ -26,9 +26,6 @@ public class OnlinelifeScanner implements ScannerCinema {
|
||||
this.fileDownloader = fileDownloader;
|
||||
this.browser = browser;
|
||||
this.saveToDir = saveToDir;
|
||||
if (!this.saveToDir.mkdirs() && !this.saveToDir.exists()) {
|
||||
throw new IllegalStateException(String.format("dir not found: '%s'", this.saveToDir.getAbsolutePath()));
|
||||
}
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ public class SeasonvarScanner implements ScannerCinema {
|
||||
this.fileDownloader = fileDownloader;
|
||||
this.browser = browser;
|
||||
this.saveTo = saveTo;
|
||||
if (!this.saveTo.mkdirs() && !this.saveTo.exists()) {
|
||||
throw new IllegalStateException(String.format("dir not found: '%s'", this.saveTo.getAbsolutePath()));
|
||||
}
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,13 @@ public class FileDownloaderImpl implements FileDownloader, Runnable {
|
||||
|
||||
@Override
|
||||
public void addFile(String url, File saveTo) {
|
||||
if (!saveTo.getParentFile().exists()) {
|
||||
if (!saveTo.getParentFile().mkdirs()) {
|
||||
throw new IllegalStateException(String.format("dir not found: '%s'",
|
||||
saveTo.getParentFile().getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
listOfEntries.put(new AbstractMap.SimpleEntry<>(url, saveTo));
|
||||
} catch (InterruptedException ignore) {
|
||||
|
||||
Reference in New Issue
Block a user