Java Path Relative getRelativeFileFromReference(String ref, File metadataFile)

Here you can find the source of getRelativeFileFromReference(String ref, File metadataFile)

Description

get Relative File From Reference

License

Open Source License

Declaration

public static File getRelativeFileFromReference(String ref, File metadataFile) throws IOException 

Method Source Code


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

import java.io.File;

import java.io.IOException;

public class Main {
    public static File getRelativeFileFromReference(String ref, File metadataFile) throws IOException {
        String parentFilePath = "";
        if (metadataFile.getParentFile() != null)
            parentFilePath = metadataFile.getParentFile().getPath();
        File file = new File(new File(parentFilePath, ref).getCanonicalFile().toString()
                .replace(new File("").getCanonicalFile().toString(), ""));
        return file;
    }//from  ww w .  j  a  v  a 2s .c om
}

Related

  1. getRelativeFile(File target, File base)
  2. getRelativeFile(File target, File baseDirectory)
  3. getRelativeFile(File targetFile, File baseFile)
  4. getRelativeFile(java.io.File srcFile, int upCount, String... childPaths)
  5. getRelativeFile(String baseDir, String fileName)
  6. getRelativeFileInternal(File canonicalBaseFile, File canonicalFileToRelativize)
  7. getRelativeFilename(File base, File target)
  8. getRelativeFileName(File file, File basedir)
  9. getRelativeFileName(File target, File realativeTo)