public class PathUtil extends Object
Constructor and Description |
---|
PathUtil() |
Modifier and Type | Method and Description |
---|---|
boolean |
equal(org.eclipse.core.runtime.IPath path1,
org.eclipse.core.runtime.IPath path2)
Deprecated.
Use
equalPath(IPath, IPath) instead. |
static boolean |
equalPath(org.eclipse.core.runtime.IPath path1,
org.eclipse.core.runtime.IPath path2)
Checks whether path1 is the same as path2.
|
static org.eclipse.core.runtime.IPath |
findProgramLocation(String prog)
Finds location of the program inspecting each path in the path list
defined by environment variable ${PATH}.
|
static org.eclipse.core.runtime.IPath |
findProgramLocation(String prog,
String pathsStr)
Finds location of the program inspecting each path in the path list.
|
static org.eclipse.core.runtime.IPath |
getCanonicalPath(org.eclipse.core.runtime.IPath fullPath)
Return the canonical path (or the passed in path, if one couldn't be found).
|
static org.eclipse.core.runtime.IPath |
getCanonicalPathWindows(org.eclipse.core.runtime.IPath fullPath)
On Windows returns the
File.getCanonicalPath() for a given absolute path. |
static org.eclipse.core.resources.IProject |
getEnclosingProject(org.eclipse.core.runtime.IPath fullPath) |
static org.eclipse.core.runtime.IPath |
getProjectRelativePath(org.eclipse.core.runtime.IPath fullPath,
org.eclipse.core.resources.IProject project) |
static org.eclipse.core.runtime.IPath |
getRawLocation(org.eclipse.core.runtime.IPath wsRelativePath) |
static org.eclipse.core.runtime.IPath |
getValidEnclosingFolder(org.eclipse.core.runtime.IPath fullPath) |
static org.eclipse.core.runtime.IPath |
getWorkspaceRelativePath(org.eclipse.core.runtime.IPath fullPath) |
static org.eclipse.core.runtime.IPath |
getWorkspaceRelativePath(String fullPath) |
static org.eclipse.core.resources.IWorkspaceRoot |
getWorkspaceRoot() |
static boolean |
isPrefix(org.eclipse.core.runtime.IPath path1,
org.eclipse.core.runtime.IPath path2)
Checks whether path1 is a prefix of path2.
|
static boolean |
isWindowsFileSystem() |
static org.eclipse.core.runtime.IPath |
makeRelativePath(org.eclipse.core.runtime.IPath path,
org.eclipse.core.runtime.IPath relativeTo) |
static org.eclipse.core.runtime.IPath |
makeRelativePathToIncludes(org.eclipse.core.runtime.IPath fullPath,
String[] includePaths) |
static org.eclipse.core.runtime.IPath |
makeRelativePathToProjectIncludes(org.eclipse.core.runtime.IPath fullPath,
org.eclipse.core.resources.IProject project) |
static int |
matchingFirstSegments(org.eclipse.core.runtime.IPath path1,
org.eclipse.core.runtime.IPath path2)
Returns the number of segments which match in path1 and path2
(device ids are ignored), comparing in increasing segment number order.
|
public static boolean isWindowsFileSystem()
public static org.eclipse.core.resources.IWorkspaceRoot getWorkspaceRoot()
public static org.eclipse.core.runtime.IPath getCanonicalPath(org.eclipse.core.runtime.IPath fullPath)
fullPath
- public static org.eclipse.core.runtime.IPath getCanonicalPathWindows(org.eclipse.core.runtime.IPath fullPath)
File.getCanonicalPath()
for a given absolute path.
On other platforms, and for relative paths returns the the original path.fullPath
- public static org.eclipse.core.runtime.IPath getWorkspaceRelativePath(org.eclipse.core.runtime.IPath fullPath)
public static org.eclipse.core.runtime.IPath getProjectRelativePath(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project)
public static org.eclipse.core.runtime.IPath getWorkspaceRelativePath(String fullPath)
public static org.eclipse.core.runtime.IPath getRawLocation(org.eclipse.core.runtime.IPath wsRelativePath)
public static org.eclipse.core.runtime.IPath makeRelativePath(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath relativeTo)
public static org.eclipse.core.runtime.IPath makeRelativePathToProjectIncludes(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project)
public static org.eclipse.core.runtime.IPath makeRelativePathToIncludes(org.eclipse.core.runtime.IPath fullPath, String[] includePaths)
public static org.eclipse.core.resources.IProject getEnclosingProject(org.eclipse.core.runtime.IPath fullPath)
public static org.eclipse.core.runtime.IPath getValidEnclosingFolder(org.eclipse.core.runtime.IPath fullPath)
@Deprecated public boolean equal(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2)
equalPath(IPath, IPath)
instead.Similar to IPath.equals(Object obj), but takes case sensitivity of the file system into account.
true
if path1 is the same as path2, and false
otherwisepublic static boolean equalPath(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2)
Similar to IPath.equals(Object obj), but takes case sensitivity of the file system into account.
true
if path1 is the same as path2, and false
otherwisepublic static boolean isPrefix(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2)
An empty path is a prefix of all paths with the same device; a root path is a prefix of all absolute paths with the same device.
Similar to IPath.isPrefixOf(IPath anotherPath), but takes case sensitivity of the file system into account.
true
if path1 is a prefix of path2, and false
otherwisepublic static int matchingFirstSegments(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2)
Similar to IPath.matchingFirstSegments(IPath anotherPath), but takes case sensitivity of the file system into account.
public static org.eclipse.core.runtime.IPath findProgramLocation(String prog, String pathsStr)
prog
- - program to find. For Windows, extensions "com" and "exe"
can be omitted.pathsStr
- - the list of paths to inspect separated by path separator
defined in the platform (i.e. ":" in Unix and ";" in Windows).
In case pathStr is null
environment variable ${PATH} is inspected.null
if not found.public static org.eclipse.core.runtime.IPath findProgramLocation(String prog)
prog
- - program to find. For Windows, extensions "com" and "exe"
can be omitted.null
if not found.Copyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.