code: public static Path createTempDirectory(Path dir, String prefix) throws IOException {
          try {
              return Files.createTempDirectory(dir, prefix);
          } catch (UnsupportedOperationException ex) {
          }
          return Files.createTempDirectory(dir, prefix);
      }
docs: Create a temporary directory with the same attributes as its parent directory.
  @param   dir
  the path to directory in which to create the directory
  @param   prefix
  the prefix string to be used in generating the directory's name;
  may be {@code null}
  @return  the path to the newly created directory that did not exist before
  this method was invoked
  @throws IOException