Here you can find the source of relativizePath(String parent, String child)
public static String relativizePath(String parent, String child)
//package com.java2s; import java.io.File; public class Main { public static String relativizePath(String parent, String child) { // Fix for SCM-772. Compare FixedGitStatusConsumer. if (parent != null && child != null) { if (parent.equals(child)) { return ""; }/*from ww w .j a v a 2 s . co m*/ if (!parent.endsWith(File.separator)) { parent += File.separator; } if (child.startsWith(parent)) { child = child.substring(parent.length()); if (child.startsWith(File.separator)) { child = child.substring(File.separator.length()); } } } return child; } }