Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: check whether or not we created destination directory (#81)
`File#mkdirs()` will already throw security errors if it fails.  We don't want to fail here as `File.#mkdirs()` will return `false` if the directory already exists - thus we should only log this case if the later file write fails.

Fixes #47
  • Loading branch information
chingor13 committed Sep 17, 2020
1 parent 05613ed commit 4bf31df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/google/cloud/DownloadComponentsMojo.java
Expand Up @@ -113,7 +113,10 @@ private void executeInner() throws MojoExecutionException {
}

// Ensure that the output directory exists
destinationDir.mkdirs();
if (!destinationDir.mkdirs()) {
getLog()
.info("Failed to create destination directory. Perhaps the directory already exists?");
}

// Update the cached manifest
try {
Expand Down

0 comments on commit 4bf31df

Please sign in to comment.