Java Path Relative getRelativeFile(File source, String path)

Here you can find the source of getRelativeFile(File source, String path)

Description

Construct the File that is separated from the given File by the given relative path.

License

Open Source License

Parameter

Parameter Description
source A File to point from.
path A relative path String pointing from the source.

Return

A File that is the implied target.

Declaration

static File getRelativeFile(File source, String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    /**/*from ww  w .j a va 2  s.  com*/
     * Construct the File that is separated from the given File by the
     * given relative path.
     * @param source A File to point from.
     * @param path A relative path String pointing from the source.
     * @return A File that is the implied target.
     */
    static File getRelativeFile(File source, String path) {
        source = source.getParentFile();
        return new File(source, path);
    }
}

Related

  1. getRelativeAncestor(File ancestor, File descendant)
  2. getRelativeBaseDirectory(final File processedFile)
  3. getRelativeChildDirectory(String parent, String child)
  4. getRelativeDirectoryPath(String in_filePath, String in_basePath)
  5. getRelativeFile(File parent, final String s2)
  6. getRelativeFile(File subj, File relativeTo)
  7. getRelativeFile(File target, File base)
  8. getRelativeFile(File target, File baseDirectory)
  9. getRelativeFile(File targetFile, File baseFile)