Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 4794aef

Browse files
committed
Ensure the directory exists before writing a file
Summary: This fixes experimental project generation for IntelliJ on Windows by ensuring that we've actually created the destination folder prior to writing out the temporary file to it. Test Plan: `buck project --experimental-ij-generation` in https://github.com/sdwilsh/xplat-buck-demo
1 parent 7d1ae34 commit 4794aef

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/com/facebook/buck/java/intellij/IjProjectWriter.java

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ protected void writeToFile(ST contents, Path path) throws IOException {
147147
try (OutputStream outputStream = projectFilesystem.newFileOutputStream(tempFile)) {
148148
outputStream.write(contents.render().getBytes());
149149
}
150+
projectFilesystem.createParentDirs(path);
150151
projectFilesystem.move(tempFile, path, StandardCopyOption.REPLACE_EXISTING);
151152
danglingTempFile = false;
152153
} finally {

0 commit comments

Comments
 (0)