mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[monitoring] fix FileAlreadyExistsException in CsvMetricsExporter if target path has a symlink
GitOrigin-RevId: 3c930d4d33d5375518aed74c77c5ece5e655606e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e50e14ed8f
commit
03f590f7ca
@@ -45,7 +45,12 @@ public final class CsvMetricsExporter implements MetricExporter {
|
||||
public CsvMetricsExporter(final @NotNull Path writeToPath) throws IOException {
|
||||
this.writeToPath = writeToPath.toAbsolutePath();
|
||||
if (!Files.exists(this.writeToPath)) {
|
||||
Files.createDirectories(this.writeToPath.getParent());
|
||||
final Path parentDir = this.writeToPath.getParent();
|
||||
if(!Files.isDirectory(parentDir)) {
|
||||
//RC: createDirectories() _does_ throw FileAlreadyExistsException if path is a _symlink_ to a directory, not a directory
|
||||
// itself (JDK-8130464). Check !isDirectory() above should work around that case.
|
||||
Files.createDirectories(parentDir);
|
||||
}
|
||||
Files.write(this.writeToPath, csvHeadersLines(), CREATE, WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user