Java Path Relative makeRelativePathAbsolute(String relativePath)

Here you can find the source of makeRelativePathAbsolute(String relativePath)

Description

make Relative Path Absolute

License

Open Source License

Declaration

public static String makeRelativePathAbsolute(String relativePath) 

Method Source Code

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

import java.io.File;

public class Main {
    public static String makeRelativePathAbsolute(String relativePath) {
        File f = new File(relativePath);
        String prefix = f.getAbsolutePath();
        if (!prefix.endsWith(File.separator)) {
            prefix = prefix + File.separator;
        }/*from w ww . java  2 s .com*/
        int lastSlash = prefix.lastIndexOf(File.separator);
        if (lastSlash != -1) {
            return prefix.substring(0, lastSlash + 1);
        }
        return null;
    }
}

Related

  1. getRelativeTemporaryFilename(String directory, String suffix, boolean autodelete)
  2. getRelativeUnixPath(File baseDir, File refFile)
  3. makeRelativePath(File from, File to)
  4. makeRelativePath(File parent, File file)
  5. makeRelativePath(IPath path, IPath relativeTo)
  6. makeRelativePaths(String classDir, List files)
  7. makeRelativePathToIncludes(IPath fullPath, String[] includePaths)