protected String translateFilePathUsingPrefix ( String file , String prefix ) throws IOException { if ( file . equals ( prefix ) ) { return "." ; } String result = new File ( file ) . getCanonicalPath ( ) . substring ( prefix . length ( ) + 1 ) ; if ( File . separatorChar != ' ' ) { result = result . replace ( File . separatorChar , ' ' ) ; } return result ; }
return either a . if file and prefix have the same value or the right part of file - length of prefix plus one removed