Check if target is directory before creating

When project/target is a symbolic link, sbt 1.4.0 crashes on startup
because Files.createDirectories will throw a FileAlreadyExistsException.
The fix is to first check if the target directory exists before trying
to create it.
This commit is contained in:
Ethan Atkins 2020-10-13 08:17:21 -07:00
parent ca8c1e704d
commit efec7bce31
1 changed files with 1 additions and 1 deletions

View File

@ -287,8 +287,8 @@ public class BootServerSocket implements AutoCloseable {
final Path base = configuration.baseDirectory().toPath().toRealPath();
final Path target = base.resolve("project").resolve("target");
if (!isWindows) {
if (!Files.isDirectory(target)) Files.createDirectories(target);
socketFile = Paths.get(socketLocation(base));
Files.createDirectories(target);
} else {
socketFile = null;
}