From: David ‘Bombe’ Roden Date: Thu, 11 Apr 2013 05:32:28 +0000 (+0200) Subject: Add fields for temporary and final download directories. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e3d6e96c5ced77d88641e8b736df57d43b08f7ec;p=xudocci.git Add fields for temporary and final download directories. --- diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 36768a4..4596f0d 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -72,6 +72,12 @@ public class Core extends AbstractIdleService { /** The event bus. */ private final EventBus eventBus; + /** The temporary directory to download files to. */ + private final String temporaryDirectory; + + /** The directory to move finished downloads to. */ + private final String finalDirectory; + /** The channels that should be monitored. */ private final Collection channels = Sets.newHashSet(); @@ -95,10 +101,16 @@ public class Core extends AbstractIdleService { * * @param eventBus * The event bus + * @param temporaryDirectory + * The directory to download files to + * @param finalDirectory + * The directory to move finished files to */ @Inject - public Core(EventBus eventBus) { + public Core(EventBus eventBus, String temporaryDirectory, String finalDirectory) { this.eventBus = eventBus; + this.temporaryDirectory = temporaryDirectory; + this.finalDirectory = finalDirectory; } // @@ -327,7 +339,8 @@ public class Core extends AbstractIdleService { public void dccSendReceived(DccSendReceived dccSendReceived) { logger.info(String.format("Starting download of %s.", dccSendReceived.filename())); try { - OutputStream fileOutputStream = new FileOutputStream(new File("/home/bombe/Temp", dccSendReceived.filename())); + File outputFile = new File(temporaryDirectory, dccSendReceived.filename()); + OutputStream fileOutputStream = new FileOutputStream(outputFile); DccReceiver dccReceiver = new DccReceiver(eventBus, dccSendReceived.inetAddress(), dccSendReceived.port(), dccSendReceived.filename(), dccSendReceived.filesize(), fileOutputStream); dccReceivers.add(dccReceiver); dccReceiver.start();