public static @NotNull String mapToLocal(@NotNull String path, @Nullable String remoteRoot, @Nullable String localRoot) {
    if (isAnyEmpty(localRoot, remoteRoot)) {
      return path;
    }
    path = norm(path);
    String remotePrefix = norm(remoteRoot);
    if (canReplaceRemote(path, remotePrefix)) {
      String left = norm(localRoot);
      String right = path.substring(remotePrefix.length());
      // Left and right part must be separated
      if ((left.endsWith("/") || left.endsWith("\\") || right.startsWith("/") || right.startsWith("\\") ||
           StringUtil.isEmpty(left) || StringUtil.isEmpty(right))) {
        path = left + right;
      }
      else {
        path = left + "/" + right;
      }
    }
    return path;
  }
public static @NotNull String mapToLocal(@NotNull String path, @Nullable String remoteRoot, @Nullable String localRoot)