Load download Folder from ReplayFileIO in DownloadedFileHandler

DRY code in ReplayFileIO to retreive and create directories from config
This commit is contained in:
CrushedPixel
2015-07-16 14:01:46 +02:00
parent ddc9ff9bcc
commit d1ffa877b0
2 changed files with 11 additions and 6 deletions

View File

@@ -29,13 +29,18 @@ public class ReplayFileIO {
private static final byte[] uniqueBytes = new byte[]{0, 1, 1, 2, 3, 5, 8};
public static File getRenderFolder() throws IOException {
File folder = new File(ReplayMod.replaySettings.getRenderPath());
FileUtils.forceMkdir(folder);
return folder;
return makeFolderFromPath(ReplayMod.replaySettings.getRenderPath());
}
public static File getReplayFolder() throws IOException {
String path = ReplayMod.replaySettings.getRecordingPath();
return makeFolderFromPath(ReplayMod.replaySettings.getRecordingPath());
}
public static File getReplayDownloadFolder() throws IOException {
return makeFolderFromPath(ReplayMod.replaySettings.getDownloadPath());
}
private static File makeFolderFromPath(String path) throws IOException {
File folder = new File(path);
FileUtils.forceMkdir(folder);
return folder;