Skip to content

Commit

Permalink
fix the crash #1858 when the maven build dir is a softlink to an actu…
Browse files Browse the repository at this point in the history
…al directory
  • Loading branch information
243826 committed Oct 30, 2023
1 parent d346ef8 commit f237fd4
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,14 @@ private void ensureParentDirExists() {
throw new IllegalStateException("Index file does not have a parent dir: " + indexFile);
}
try {
Files.createDirectories(parentDir);
if (Files.exists(parentDir, LinkOption.NOFOLLOW_LINKS)) {
Path realPath = parentDir.toRealPath();
if (!Files.exists(realPath)) {
Files.createDirectories(realPath);
}
} else {
Files.createDirectories(parentDir);
}
} catch (IOException e) {
throw new UncheckedIOException("Unable to create parent directory for the index file: " + indexFile, e);
}
Expand Down

0 comments on commit f237fd4

Please sign in to comment.