public class PathUtil extends Object
| Constructor and Description |
|---|
PathUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getRelativePath(String targetPath,
String basePath)
Get the relative path from one file to another, specifying the directory
separator.
|
static String |
getRelativePath(String targetPath,
String basePath,
String pathSeparator)
Get the relative path from one file to another, specifying the directory
separator.
|
static String |
getSubPath(File f,
File parentDir)
Returns relative path from parentDir to f.
|
static void |
makeDirs(File dir)
Creates dir and its parents
|
static boolean |
makeParents(File f) |
public static String getRelativePath(String targetPath, String basePath) throws org.zanata.util.PathUtil.PathResolutionException
target - targetPath is calculated to this filebase - basePath is calculated from this filePathResolutionException - if no relative path existsorg.zanata.util.PathUtil.PathResolutionExceptionpublic static String getRelativePath(String targetPath, String basePath, String pathSeparator) throws org.zanata.util.PathUtil.PathResolutionException
target - targetPath is calculated to this filebase - basePath is calculated from this fileseparator - directory separator. The platform default is not assumed so
that we can test Unix behaviour when running on Windows (for
example)PathResolutionException - if no relative path existsorg.zanata.util.PathUtil.PathResolutionExceptionpublic static String getSubPath(File f, File parentDir) throws IOException, org.zanata.util.PathUtil.PathResolutionException
f - a file inside parentDirparentDir - IOExceptionPathResolutionExceptionorg.zanata.util.PathUtil.PathResolutionExceptionpublic static void makeDirs(@Nullable File dir) throws IOException
dir - directory to create, along with any required parent dirsIOException - if any of the dirs do not exist and can't be createdpublic static boolean makeParents(File f) throws IOException
IOExceptionCopyright © 2016 Zanata Project. All rights reserved.