Skip to content

Commit

Permalink
Ensure Files.createTempDirectory honors java.io.tmpdir system property
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Gopalpuri <[email protected]>
  • Loading branch information
arun0009 committed Dec 11, 2024
1 parent 5aa6509 commit 19bb95c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ static void exit(final int status) {
}

@SuppressForbidden(reason = "Files#createTempDirectory(String, FileAttribute...)")
static Path createTempDirectory(final String prefix, final FileAttribute<?>... attrs) throws IOException {
return Files.createTempDirectory(prefix, attrs);
static Path createTempDirectory(final Path rootDir, final String prefix, final FileAttribute<?>... attrs) throws IOException {
return Files.createTempDirectory(rootDir, prefix, attrs);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void main(final String[] args) throws IOException {
path = Paths.get(System.getProperty("java.io.tmpdir"), "opensearch");
Files.createDirectories(path);
} else {
path = Launchers.createTempDirectory("opensearch-");
path = Launchers.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir"), "opensearch-");
}
Launchers.outPrintln(path.toString());
}
Expand Down

0 comments on commit 19bb95c

Please sign in to comment.