Java Path Relative Get getRelativePath(File file)

Here you can find the source of getRelativePath(File file)

Description

get Relative Path

License

Apache License

Declaration

private static String getRelativePath(File file) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;

public class Main {

    private static String getRelativePath(File file) throws IOException {
        String curPath = new File(".").getCanonicalPath();
        String targetPath = file.getCanonicalPath();

        return targetPath.substring(curPath.length() + 1);
    }//from   w  w  w.j  av a  2  s .c om
}

Related

  1. getRelativePath(File child, File directory)
  2. getRelativePath(File currentDir, File target)
  3. getRelativePath(File dir, File child)
  4. getRelativePath(File dir, File file)
  5. getRelativePath(File f, File base)
  6. getRelativePath(File file, File basedir)
  7. getRelativePath(File file, File baseDir)
  8. getRelativePath(File file, File baseDirectory)
  9. getRelativePath(File file, File directory)