Create non-existing parent directories of IPC port file.

This commit is contained in:
Sebastian Stenzel
2017-04-29 10:12:39 +02:00
parent c046056736
commit f62c0b4ca8

View File

@@ -221,6 +221,7 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
ByteBuffer buf = ByteBuffer.allocate(Integer.BYTES);
buf.putInt(port);
buf.flip();
Files.createDirectories(path.getParent());
try (WritableByteChannel ch = Files.newByteChannel(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
if (ch.write(buf) != Integer.BYTES) {
throw new IOException("Did not write expected number of bytes.");