public static void escapeWindowsPath(Appendable result, String val) throws IOException {
    if (!val.isEmpty() && WINDOWS_PATH_PATTERN.matcher(val).matches()) {
      // Adapted from StringUtils.replace in plexus-utils to accommodate pre-escaped backslashes.
      int start = 0, end;
      while ((end = val.indexOf('\\', start)) != -1) {
        result.append(val, start, end).append("\\\\");
        start = end + 1;

        if (val.indexOf('\\', end + 1) == end + 1) {
          start++;
        }
      }

      result.append(val, start, val.length());
    }
    else {
      result.append(val);
    }
  }
public static void escapeWindowsPath(Appendable result, String val)