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.

View | Details | Raw Unified | Return to bug 34730
Collapse All | Expand All

(-)FileUtil.java (+20 lines)
Line 534 Link Here
534
    /**
535
     * Gets a relative resource path between folder and fo.
536
     * @param folder root of filesystem or any other folder in folders hierarc
537
     * @param fo arbitrary FileObject in folder's tree
538
     * @return relative path between folder and fo. The returned path
539
     * never starts with a '/'. It never ends with a '/'. Returns <code>null</
540
     * if fo is not in folder's tree.
541
     * @see #isParentOf
542
     * @since 4.14
543
     */
544
    public static String getRelativePath(FileObject folder, FileObject fo) {
545
         if (!isParentOf(folder, fo) && folder != fo) {
546
            return null;
547
         }
548
        String result = fo.getPath().substring(folder.getPath().length());
549
        if (result.startsWith("/")) {
550
            result = result.substring(1);
551
        }
552
        return result;
553
    }

Return to bug 34730