code: private static File getDirectoryIfExists(final File existingCandidate, final String path) {
          if (existingCandidate != null) {
              return existingCandidate;
          }
          if (!Strings.isNullOrEmpty(path)) {
              final File directory = new File(path);
              if (directory.exists() && directory.isDirectory()) {
                  return directory;
              }
          }
          return null;
      }
docs: Gets a candidate directory based on a file path, if it exists, and if it
  another candidate hasn't already been resolved.
  
  @param existingCandidate
  an existing candidate directory. If this is non-null, it will
  be returned immediately.
  @param path
  the path of a directory
  @return a candidate directory, or null if none was resolved.