code: public static File getRelativePath(final File basePath, final File refPath) {
          if (!basePath.toPath().getRoot().equals(refPath.toPath().getRoot())) {
              return refPath;
          }
          return basePath.toPath().getParent().relativize(refPath.toPath()).toFile();
      }
docs: Resolves a path reference against a base path.
  
  @param basePath base path
  @param refPath reference path
  @return relative path, or refPath if different root means no relative path is possible