Change the download event. Fix some bugs in download manager. Other minor changes.

This commit is contained in:
inorichi
2015-11-06 03:29:23 +01:00
parent 2683cad5b5
commit d3a32da62c
10 changed files with 148 additions and 100 deletions

View File

@@ -115,10 +115,8 @@ public final class DiskUtils {
}
public static File saveBufferedSourceToDirectory(BufferedSource bufferedSource, File directory, String name) throws IOException {
if (!directory.exists()) {
if (!directory.mkdirs()) {
throw new IOException("Failed Creating Directory");
}
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Failed Creating Directory");
}
File writeFile = new File(directory, name);
@@ -155,5 +153,12 @@ public final class DiskUtils {
inputFile.delete();
}
public static synchronized void createDirectory(File directory) throws IOException {
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Failed creating directory");
}
}
}