private Set < String > convertAbsToRelative ( Collection < File > files ) { Set < String > result = new HashSet < String > ( ) ; for ( File f : files ) { String fAbsPath = PathUtils . fixPathString ( f ) ; //assumption here that f is a dir, and path will end in File.seperator if ( fAbsPath . startsWith ( rootAbsolutePath ) ) { String absPath = fAbsPath ; // canonicalPath(f); absPath = absPath . substring ( rootAbsolutePath . length ( ) ) ; if ( "\\" . equals ( File . separator ) ) { absPath = absPath . replace ( ' ' , ' ' ) ; } //handle / case. (path will have been the same, so the substring created emptystring) if ( absPath . length ( ) == 0 ) { absPath = "/" ; } result . add ( absPath ) ; } else throw new IllegalStateException ( fAbsPath + " " + rootAbsolutePath ) ; } return result ; }
convert java . io . files into relative paths under the root container .