Skip to content

Commit

Permalink
create home directory path if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
litvinovg committed Oct 10, 2024
1 parent e98711b commit 54577a4
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ private void confirmExactlyOneResult() {
private void confirmValidDirectory() {
Path vhd = getPath();
if (!Files.exists(vhd)) {
throw new IllegalStateException("Vitro home directory '" + vhd
+ "' does not exist.");
createHomeDirectory(vhd);
}
if (!Files.isDirectory(vhd)) {
throw new IllegalStateException("Vitro home directory '" + vhd
Expand Down Expand Up @@ -241,6 +240,18 @@ public void populate() {

}

/**
* Create home directory
*/
private static void createHomeDirectory(Path vhdDir) {
try {
vhdDir.toFile().mkdirs();
} catch (Exception e) {
log.error(e, e);
throw new RuntimeException("Failed to create home directory " + vhdDir);
}
}

/**
* Copy file from home source to home destination
*/
Expand Down

0 comments on commit 54577a4

Please sign in to comment.