This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
/**
* Gets a relative resource path between folder and fo.
* @param folder root of filesystem or any other folder in folders hierarc
* @param fo arbitrary FileObject in folder's tree
* @return relative path between folder and fo. The returned path
* never starts with a '/'. It never ends with a '/'. Returns <code>null</
* if fo is not in folder's tree.
* @see #isParentOf
* @since 4.14
*/
public static String getRelativePath(FileObject folder, FileObject fo) {
if (!isParentOf(folder, fo) && folder != fo) {
return null;
}
String result = fo.getPath().substring(folder.getPath().length());
if (result.startsWith("/")) {
result = result.substring(1);
return result;