question: private void ensureOutputDirectory ( Path dir ) { if ( ! Files . exists ( dir ) ) { try { Files . createDirectories ( dir ) ; } catch ( IOException e ) { throw ShowMessageException . error ( "Error created output directory " + dir , null ) ; } } else if ( ! Files . isDirectory ( dir ) ) throw ShowMessageException . error ( "Output directory " + dir + " is not a directory" , null ) ; }
target:  Ensure output directory exists 