public static File getFirstDirectory(File file) {
        File result = file;
        while (result.getParentFile() != null) {
            result = result.getParentFile();
        }

        return result;
    }
Creates a unique file under {@code java.io.tmpdir} and returns the {@link File#getCanonicalFile() canonical}
{@code File}.  The optional {@code preserveMode} parameter dictates who is responsible for deleting the created
file, and when.  This methodology
<ol>
  <li>guarantees a unique file name,</li>
  <li>doesn't clutter the filesystem with test-related directories or files,</li>
  <li>returns an absolute path (important for relative volume binding strings),
  <li>and returns a canonical file name.</li>
</ol>

@param nameHint a string used to help create the temporary file name, may be {@code null}
@param preserveMode mechanism for handling the clean up of files created by this method, may be {@code null}
which is equivalent to {@link TMP_FILE_PRESERVE_MODE#DELETE_ON_EXIT}
@return the absolute temporary file, which may not exist depending on the {@code preserveMode}
src/test/java/io/fabric8/maven/docker/util/PathTestUtil.java