X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProjectInserter.java;h=8821ad60e1dfeda8ffa27829128143a6398a89f9;hb=018544bee9a02a7bf9f0972b8dc0a3f675535dbc;hp=b7d448acc6b3cc6708ded57c564cac66b9e1f66c;hpb=c00ddf5d52a5ce4631d8fe7a5d229003e75808b2;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/ProjectInserter.java b/src/de/todesbaum/jsite/application/ProjectInserter.java index b7d448a..8821ad6 100644 --- a/src/de/todesbaum/jsite/application/ProjectInserter.java +++ b/src/de/todesbaum/jsite/application/ProjectInserter.java @@ -80,6 +80,9 @@ public class ProjectInserter implements FileScannerListener, Runnable { /** Object used for synchronization. */ protected final Object lockObject = new Object(); + /** The temp directory. */ + private String tempDirectory; + /** * Adds a listener to the list of registered listeners. * @@ -195,6 +198,17 @@ public class ProjectInserter implements FileScannerListener, Runnable { } /** + * Sets the temp directory to use. + * + * @param tempDirectory + * The temp directory to use, or {@code null} to use the system + * default + */ + public void setTempDirectory(String tempDirectory) { + this.tempDirectory = tempDirectory; + } + + /** * Starts the insert. */ public void start() { @@ -266,7 +280,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { * if an I/O error occurs */ private InputStream createContainerInputStream(Map> containerFiles, String containerName, int edition, long[] containerLength) throws IOException { - File tempFile = File.createTempFile("jsite", ".zip"); + File tempFile = File.createTempFile("jsite", ".zip", (tempDirectory == null) ? null : new File(tempDirectory)); tempFile.deleteOnExit(); FileOutputStream fileOutputStream = new FileOutputStream(tempFile); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream);